|
15 | 15 |
|
16 | 16 | package software.amazon.smithy.aws.typescript.codegen;
|
17 | 17 |
|
| 18 | +import java.util.Map; |
| 19 | +import software.amazon.smithy.model.Model; |
| 20 | +import software.amazon.smithy.typescript.codegen.TypeScriptCodegenContext; |
| 21 | +import software.amazon.smithy.typescript.codegen.TypeScriptSettings; |
18 | 22 | import software.amazon.smithy.typescript.codegen.endpointsV2.EndpointsParamNameMap;
|
19 | 23 | import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
|
20 | 24 | import software.amazon.smithy.utils.MapUtils;
|
21 | 25 | import software.amazon.smithy.utils.SmithyInternalApi;
|
22 | 26 |
|
| 27 | + |
23 | 28 | @SmithyInternalApi
|
24 | 29 | public class AddEndpointsV2ParameterNameMap implements TypeScriptIntegration {
|
| 30 | + public static final Map<String, String> NAME_MAP = MapUtils.of( |
| 31 | + "Region", "region", |
| 32 | + "UseFIPS", "useFipsEndpoint", |
| 33 | + "UseDualStack", "useDualstackEndpoint", |
| 34 | + "ForcePathStyle", "forcePathStyle", |
| 35 | + "Accelerate", "useAccelerateEndpoint", |
| 36 | + "DisableMRAP", "disableMultiregionAccessPoints", |
| 37 | + "DisableMultiRegionAccessPoints", "disableMultiregionAccessPoints", |
| 38 | + "UseArnRegion", "useArnRegion", |
| 39 | + "Endpoint", "endpoint", |
| 40 | + "UseGlobalEndpoint", "useGlobalEndpoint" |
| 41 | + ); |
| 42 | + |
25 | 43 | public AddEndpointsV2ParameterNameMap() {
|
26 |
| - EndpointsParamNameMap.setNameMapping(MapUtils.of( |
27 |
| - "Region", "region", |
28 |
| - "UseFIPS", "useFipsEndpoint", |
29 |
| - "UseDualStack", "useDualstackEndpoint", |
30 |
| - "ForcePathStyle", "forcePathStyle", |
31 |
| - "Accelerate", "useAccelerateEndpoint", |
32 |
| - "DisableMRAP", "disableMultiregionAccessPoints", |
33 |
| - "DisableMultiRegionAccessPoints", "disableMultiregionAccessPoints", |
34 |
| - "UseArnRegion", "useArnRegion", |
35 |
| - "Endpoint", "endpoint", |
36 |
| - "UseGlobalEndpoint", "useGlobalEndpoint" |
37 |
| - )); |
| 44 | + setParameterNameMapForAws(); |
| 45 | + } |
| 46 | + |
| 47 | + @Override |
| 48 | + public Model preprocessModel(Model model, TypeScriptSettings settings) { |
| 49 | + setParameterNameMapForAws(); |
| 50 | + return TypeScriptIntegration.super.preprocessModel(model, settings); |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + public void customize(TypeScriptCodegenContext codegenContext) { |
| 55 | + setParameterNameMapForAws(); |
| 56 | + } |
| 57 | + |
| 58 | + private static void setParameterNameMapForAws() { |
| 59 | + EndpointsParamNameMap.addNameMapping(NAME_MAP); |
38 | 60 | }
|
39 | 61 | }
|
0 commit comments