Loading aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class S3(codegenContext: CodegenContext) : RestXml(codegenContext) { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), "base_errors" to restXmlErrors, "s3_errors" to AwsRuntimeType.S3Errors, ) Loading @@ -104,7 +104,7 @@ class S3(codegenContext: CodegenContext) : RestXml(codegenContext) { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType { return RuntimeType.forInlineFun("parse_http_generic_error", RustModule.private("xml_deser")) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rustTemplate( Loading codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/AwsQuery.kt +3 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), ) private val xmlDeserModule = RustModule.private("xml_deser") Loading @@ -70,7 +70,7 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_http_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(response.body().as_ref())", awsQueryErrors) Loading @@ -80,7 +80,7 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_event_stream_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlError}>", "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(payload.as_ref())", awsQueryErrors) Loading codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/Ec2Query.kt +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), ) private val xmlDeserModule = RustModule.private("xml_deser") Loading Loading @@ -61,7 +61,7 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_http_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(response.body().as_ref())", ec2QueryErrors) Loading @@ -71,7 +71,7 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_event_stream_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlError}>", "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(payload.as_ref())", ec2QueryErrors) Loading codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/RestXml.kt +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ open class RestXml(val codegenContext: CodegenContext) : Protocol { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), ) private val xmlDeserModule = RustModule.private("xml_deser") Loading Loading @@ -60,7 +60,7 @@ open class RestXml(val codegenContext: CodegenContext) : Protocol { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_http_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(response.body().as_ref())", restXmlErrors) Loading @@ -70,7 +70,7 @@ open class RestXml(val codegenContext: CodegenContext) : Protocol { override fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_event_stream_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlError}>", "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(payload.as_ref())", restXmlErrors) Loading codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt +5 −5 Original line number Diff line number Diff line Loading @@ -42,24 +42,24 @@ class AwsQueryParserGenerator( rustTemplate( """ if !(${XmlBindingTraitParserGenerator.XmlName(responseWrapperName).matchExpression("start_el")}) { return Err(#{XmlError}::custom(format!("invalid root, expected $responseWrapperName got {:?}", start_el))) return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $responseWrapperName got {:?}", start_el))) } if let Some(mut result_tag) = decoder.next_tag() { let start_el = result_tag.start_el(); if !(${XmlBindingTraitParserGenerator.XmlName(resultWrapperName).matchExpression("start_el")}) { return Err(#{XmlError}::custom(format!("invalid result, expected $resultWrapperName got {:?}", start_el))) return Err(#{XmlDecodeError}::custom(format!("invalid result, expected $resultWrapperName got {:?}", start_el))) } """, "XmlError" to context.xmlErrorType, "XmlDecodeError" to context.xmlDecodeErrorType, ) inner("result_tag") rustTemplate( """ } else { return Err(#{XmlError}::custom("expected $resultWrapperName tag")) return Err(#{XmlDecodeError}::custom("expected $resultWrapperName tag")) }; """, "XmlError" to context.xmlErrorType, "XmlDecodeError" to context.xmlDecodeErrorType, ) }, ) : StructuredDataParserGenerator by xmlBindingTraitParserGenerator Loading
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class S3(codegenContext: CodegenContext) : RestXml(codegenContext) { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), "base_errors" to restXmlErrors, "s3_errors" to AwsRuntimeType.S3Errors, ) Loading @@ -104,7 +104,7 @@ class S3(codegenContext: CodegenContext) : RestXml(codegenContext) { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType { return RuntimeType.forInlineFun("parse_http_generic_error", RustModule.private("xml_deser")) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rustTemplate( Loading
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/AwsQuery.kt +3 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), ) private val xmlDeserModule = RustModule.private("xml_deser") Loading @@ -70,7 +70,7 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_http_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(response.body().as_ref())", awsQueryErrors) Loading @@ -80,7 +80,7 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_event_stream_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlError}>", "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(payload.as_ref())", awsQueryErrors) Loading
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/Ec2Query.kt +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), ) private val xmlDeserModule = RustModule.private("xml_deser") Loading Loading @@ -61,7 +61,7 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_http_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(response.body().as_ref())", ec2QueryErrors) Loading @@ -71,7 +71,7 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol { override fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_event_stream_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlError}>", "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(payload.as_ref())", ec2QueryErrors) Loading
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/RestXml.kt +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ open class RestXml(val codegenContext: CodegenContext) : Protocol { "Error" to RuntimeType.GenericError(runtimeConfig), "HeaderMap" to RuntimeType.http.member("HeaderMap"), "Response" to RuntimeType.http.member("Response"), "XmlError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlError"), "XmlDecodeError" to CargoDependency.smithyXml(runtimeConfig).asType().member("decode::XmlDecodeError"), ) private val xmlDeserModule = RustModule.private("xml_deser") Loading Loading @@ -60,7 +60,7 @@ open class RestXml(val codegenContext: CodegenContext) : Protocol { override fun parseHttpGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_http_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlError}>", "pub fn parse_http_generic_error(response: &#{Response}<#{Bytes}>) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(response.body().as_ref())", restXmlErrors) Loading @@ -70,7 +70,7 @@ open class RestXml(val codegenContext: CodegenContext) : Protocol { override fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType = RuntimeType.forInlineFun("parse_event_stream_generic_error", xmlDeserModule) { rustBlockTemplate( "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlError}>", "pub fn parse_event_stream_generic_error(payload: &#{Bytes}) -> Result<#{Error}, #{XmlDecodeError}>", *errorScope, ) { rust("#T::parse_generic_error(payload.as_ref())", restXmlErrors) Loading
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt +5 −5 Original line number Diff line number Diff line Loading @@ -42,24 +42,24 @@ class AwsQueryParserGenerator( rustTemplate( """ if !(${XmlBindingTraitParserGenerator.XmlName(responseWrapperName).matchExpression("start_el")}) { return Err(#{XmlError}::custom(format!("invalid root, expected $responseWrapperName got {:?}", start_el))) return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $responseWrapperName got {:?}", start_el))) } if let Some(mut result_tag) = decoder.next_tag() { let start_el = result_tag.start_el(); if !(${XmlBindingTraitParserGenerator.XmlName(resultWrapperName).matchExpression("start_el")}) { return Err(#{XmlError}::custom(format!("invalid result, expected $resultWrapperName got {:?}", start_el))) return Err(#{XmlDecodeError}::custom(format!("invalid result, expected $resultWrapperName got {:?}", start_el))) } """, "XmlError" to context.xmlErrorType, "XmlDecodeError" to context.xmlDecodeErrorType, ) inner("result_tag") rustTemplate( """ } else { return Err(#{XmlError}::custom("expected $resultWrapperName tag")) return Err(#{XmlDecodeError}::custom("expected $resultWrapperName tag")) }; """, "XmlError" to context.xmlErrorType, "XmlDecodeError" to context.xmlDecodeErrorType, ) }, ) : StructuredDataParserGenerator by xmlBindingTraitParserGenerator