Skip to content

Commit

Permalink
Add Sensitivity codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Barber committed Sep 20, 2022
1 parent 46ffa8f commit b3c0663
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class ServerOperationGenerator(
fun render(writer: RustWriter) {
writer.documentShape(operation, model)

val generator = ServerHttpSensitivityGenerator(model, operation, runtimeConfig)
val requestFmt = generator.requestFmt()
val responseFmt = generator.responseFmt()

writer.rustTemplate(
"""
pub struct $operationName;
Expand All @@ -56,8 +60,25 @@ class ServerOperationGenerator(
type Output = crate::output::${operationName}Output;
type Error = #{Error:W};
}
impl #{SmithyHttpServer}::logging::sensitivity::Sensitivity for $operationName {
type RequestFmt = #{RequestType:W};
type ResponseFmt = #{ResponseType:W};
fn request_fmt() -> Self::RequestFmt {
#{RequestValue:W}
}
fn response_fmt() -> Self::ResponseFmt {
#{ResponseValue:W}
}
}
""",
"Error" to operationError(),
"RequestValue" to requestFmt.value,
"RequestType" to requestFmt.type,
"ResponseValue" to responseFmt.value,
"ResponseType" to responseFmt.type,
*codegenScope,
)
// Adds newline to end of render
Expand Down

0 comments on commit b3c0663

Please sign in to comment.