Skip to content

Commit 11844a6

Browse files
mtdowlingkstich
authored andcommitted
chore: update codegen plugins to new format (#425)
1 parent 7f37e78 commit 11844a6

File tree

1 file changed

+27
-29
lines changed
  • codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen

1 file changed

+27
-29
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddBuiltinPlugins.java

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
package software.amazon.smithy.aws.typescript.codegen;
1717

18+
import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention;
19+
1820
import java.util.List;
19-
import software.amazon.smithy.codegen.core.Symbol;
20-
import software.amazon.smithy.codegen.core.SymbolReference;
2121
import software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin;
2222
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
2323
import software.amazon.smithy.utils.ListUtils;
@@ -27,36 +27,34 @@
2727
*/
2828
public class AddBuiltinPlugins implements TypeScriptIntegration {
2929

30+
private static final String CONFIG_RESOLVER_VERSION = "^0.1.0-preview.5";
31+
3032
@Override
3133
public List<RuntimeClientPlugin> getClientPlugins() {
34+
// Note that order is significant because configurations might
35+
// rely on previously resolved values.
3236
return ListUtils.of(
33-
generatePlugin("Region", "@aws-sdk/config-resolver"),
34-
generatePlugin("AwsAuth", "@aws-sdk/signing-middleware"),
35-
generatePlugin("Endpoints", "@aws-sdk/config-resolver"),
36-
generatePlugin("Retry", "@aws-sdk/retry-middleware"),
37-
generatePlugin("UserAgent", "@aws-sdk/middleware-user-agent")
37+
RuntimeClientPlugin.builder()
38+
.withConventions("@aws-sdk/config-resolver", CONFIG_RESOLVER_VERSION, "Region",
39+
Convention.HAS_CONFIG)
40+
.build(),
41+
RuntimeClientPlugin.builder()
42+
.withConventions("@aws-sdk/middleware-signing", "^0.1.0-preview.7", "AwsAuth")
43+
.build(),
44+
RuntimeClientPlugin.builder()
45+
.withConventions("@aws-sdk/config-resolver", CONFIG_RESOLVER_VERSION, "Endpoints",
46+
Convention.HAS_CONFIG)
47+
.build(),
48+
RuntimeClientPlugin.builder()
49+
.withConventions("@aws-sdk/middleware-retry", "^0.1.0-preview.5", "Retry")
50+
.build(),
51+
RuntimeClientPlugin.builder()
52+
.withConventions("@aws-sdk/middleware-user-agent", "^0.1.0-preview.1", "UserAgent")
53+
.build(),
54+
RuntimeClientPlugin.builder()
55+
.withConventions("@aws-sdk/middleware-content-length", "^0.1.0-preview.5", "ContentLength",
56+
Convention.HAS_MIDDLEWARE)
57+
.build()
3858
);
3959
}
40-
41-
private static RuntimeClientPlugin generatePlugin(String symbolName, String symbolNamespace) {
42-
SymbolReference symbolReference = SymbolReference.builder()
43-
.symbol(Symbol.builder().name(symbolName).namespace(symbolNamespace, "/").build())
44-
.build();
45-
return new RuntimeClientPlugin() {
46-
@Override
47-
public SymbolReference getSymbol() {
48-
return symbolReference;
49-
}
50-
51-
@Override
52-
public boolean hasConfig() {
53-
return true;
54-
}
55-
56-
@Override
57-
public boolean hasMiddleware() {
58-
return true;
59-
}
60-
};
61-
}
6260
}

0 commit comments

Comments
 (0)