|
7 | 7 | import static software.amazon.smithy.python.aws.codegen.AwsConfiguration.REGION; |
8 | 8 |
|
9 | 9 | import java.util.List; |
10 | | -import java.util.Set; |
11 | 10 | import software.amazon.smithy.aws.traits.auth.SigV4Trait; |
12 | 11 | import software.amazon.smithy.codegen.core.Symbol; |
13 | 12 | import software.amazon.smithy.model.shapes.ServiceShape; |
|
16 | 15 | import software.amazon.smithy.python.codegen.CodegenUtils; |
17 | 16 | import software.amazon.smithy.python.codegen.ConfigProperty; |
18 | 17 | import software.amazon.smithy.python.codegen.GenerationContext; |
| 18 | +import software.amazon.smithy.python.codegen.RuntimeTypes; |
19 | 19 | import software.amazon.smithy.python.codegen.SmithyPythonDependency; |
20 | 20 | import software.amazon.smithy.python.codegen.integrations.AuthScheme; |
21 | 21 | import software.amazon.smithy.python.codegen.integrations.PythonIntegration; |
@@ -98,20 +98,21 @@ public void customize(GenerationContext context) { |
98 | 98 | // must be accounted for. |
99 | 99 | context.writerDelegator().useFileWriter(resolver.getDefinitionFile(), resolver.getNamespace(), writer -> { |
100 | 100 | writer.addDependency(SmithyPythonDependency.SMITHY_HTTP); |
101 | | - writer.addImport("smithy_core.interfaces.auth", "AuthOption", "AuthOptionProtocol"); |
102 | | - writer.addImports("smithy_core.auth", Set.of("AuthOption", "AuthParams")); |
103 | | - writer.addImport("smithy_core.shapes", "ShapeID"); |
104 | 101 | writer.pushState(); |
105 | 102 |
|
106 | 103 | writer.write(""" |
107 | | - def $1L(auth_params: AuthParams[Any, Any]) -> AuthOptionProtocol | None: |
108 | | - return AuthOption( |
109 | | - scheme_id=ShapeID($2S), |
| 104 | + def $1L(auth_params: $2T[Any, Any]) -> $3T | None: |
| 105 | + return $4T( |
| 106 | + scheme_id=$5T($6S), |
110 | 107 | identity_properties={}, # type: ignore |
111 | 108 | signer_properties={} # type: ignore |
112 | 109 | ) |
113 | 110 | """, |
114 | 111 | SIGV4_OPTION_GENERATOR_NAME, |
| 112 | + RuntimeTypes.AUTH_PARAMS, |
| 113 | + RuntimeTypes.AUTH_OPTION_INTERFACE, |
| 114 | + RuntimeTypes.AUTH_OPTION, |
| 115 | + RuntimeTypes.SHAPE_ID, |
115 | 116 | SigV4Trait.ID.toString()); |
116 | 117 | writer.popState(); |
117 | 118 | }); |
|
0 commit comments