46
46
import software .amazon .smithy .model .shapes .ShapeId ;
47
47
import software .amazon .smithy .model .traits .PaginatedTrait ;
48
48
import software .amazon .smithy .model .validation .ValidationEvent ;
49
+ import software .amazon .smithy .rulesengine .traits .EndpointRuleSetTrait ;
50
+ import software .amazon .smithy .typescript .codegen .endpointsV2 .EndpointsV2Generator ;
49
51
import software .amazon .smithy .typescript .codegen .integration .ProtocolGenerator ;
50
52
import software .amazon .smithy .typescript .codegen .integration .RuntimeClientPlugin ;
51
53
import software .amazon .smithy .typescript .codegen .integration .TypeScriptIntegration ;
@@ -160,6 +162,7 @@ public void generateService(GenerateServiceDirective<TypeScriptCodegenContext, T
160
162
}
161
163
if (settings .generateClient () || settings .generateServerSdk ()) {
162
164
generateCommands (directive );
165
+ generateEndpointV2 (directive );
163
166
}
164
167
165
168
if (settings .generateServerSdk ()) {
@@ -168,7 +171,6 @@ public void generateService(GenerateServiceDirective<TypeScriptCodegenContext, T
168
171
169
172
ProtocolGenerator protocolGenerator = directive .context ().protocolGenerator ();
170
173
SymbolProvider symbolProvider = directive .symbolProvider ();
171
- List <TypeScriptIntegration > integrations = directive .context ().integrations ();
172
174
if (protocolGenerator != null ) {
173
175
LOGGER .info ("Generating serde for protocol " + protocolGenerator .getName () + " on " + service .getId ());
174
176
String fileName = Paths .get (CodegenUtils .SOURCE_FOLDER , ProtocolGenerator .PROTOCOLS_FOLDER ,
@@ -297,6 +299,14 @@ private void generateCommands(GenerateServiceDirective<TypeScriptCodegenContext,
297
299
}
298
300
}
299
301
302
+ private void generateEndpointV2 (GenerateServiceDirective <TypeScriptCodegenContext , TypeScriptSettings > directive ) {
303
+ if (!directive .shape ().hasTrait (EndpointRuleSetTrait .class )) {
304
+ return ;
305
+ }
306
+
307
+ new EndpointsV2Generator (directive .settings (), directive .model (), directive .fileManifest ()).run ();
308
+ }
309
+
300
310
private void generateServiceInterface (GenerateServiceDirective <TypeScriptCodegenContext ,
301
311
TypeScriptSettings > directive ) {
302
312
ServiceShape service = directive .shape ();
0 commit comments