-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only generate the
presign
customize operation method for ops that s…
…upport it
- Loading branch information
Showing
6 changed files
with
105 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...smithy/rust/codegen/client/smithy/generators/client/CustomizableOperationImplGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.client.smithy.generators.client | ||
|
||
import software.amazon.smithy.model.shapes.OperationShape | ||
import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext | ||
import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationCustomization | ||
import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationSection | ||
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter | ||
import software.amazon.smithy.rust.codegen.core.rustlang.rust | ||
import software.amazon.smithy.rust.codegen.core.smithy.customize.allCustomizationsAreEmpty | ||
import software.amazon.smithy.rust.codegen.core.smithy.customize.writeCustomizations | ||
|
||
class CustomizableOperationImplGenerator( | ||
private val codegenContext: ClientCodegenContext, | ||
private val operation: OperationShape, | ||
private val customizations: List<OperationCustomization>, | ||
) { | ||
fun render(writer: RustWriter) { | ||
val section = OperationSection.CustomizableOperationImpl(customizations, operation) | ||
// When no customizations are set or there is nothing to write, return early. | ||
if (customizations.isEmpty() || allCustomizationsAreEmpty(customizations, section)) { | ||
return | ||
} | ||
|
||
writer.rust("impl<E, B> CustomizableOperation<#T, E, B> {", codegenContext.symbolProvider.toSymbol(operation)) | ||
writer.writeCustomizations(customizations, section) | ||
writer.rust("}") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters