public void customize()

in codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AddSTSAuthCustomizations.java [123:204]


    public void customize(TypeScriptCodegenContext codegenContext) {
        BiConsumer<String, Consumer<TypeScriptWriter>> writerFactory =
            codegenContext.writerDelegator()::useFileWriter;
        // src/defaultRoleAssumers.ts
        writerFactory.accept(CodegenUtils.SOURCE_FOLDER + "/" + ROLE_ASSUMERS_FILE + ".ts", writer -> {
            String resourceName = STS_CLIENT_PREFIX + ROLE_ASSUMERS_FILE + ".ts";
            writer
                .pushState()
                .putContext(Map.of(
                    "noTouchNoticePrefix", NO_TOUCH_NOTICE_PREFIX,
                    "resourceName", resourceName,
                    "body", IoUtils.readUtf8Resource(AwsTraitsUtils.class, resourceName)
                ))
                .write("""
                    ${noTouchNoticePrefix:L}${resourceName:L}
                    ${body:L}
                    """)
                .popState();
        });
        // src/defaultStsRoleAssumers.ts
        writerFactory.accept(CodegenUtils.SOURCE_FOLDER + "/" + STS_ROLE_ASSUMERS_FILE + ".ts", writer -> {
            String resourceName = STS_CLIENT_PREFIX + STS_ROLE_ASSUMERS_FILE + ".ts";
            writer
                .pushState()
                .putContext(Map.of(
                    "noTouchNoticePrefix", NO_TOUCH_NOTICE_PREFIX,
                    "resourceName", resourceName,
                    "body", IoUtils.readUtf8Resource(AwsTraitsUtils.class, resourceName)
                ))
                .write("""
                    ${noTouchNoticePrefix:L}${resourceName:L}
                    ${body:L}
                    """)
                .popState();
        });
        // src/index.ts
        writerFactory.accept(CodegenUtils.SOURCE_FOLDER + "/index.ts", writer -> {
            writer.write("export * from $S", "./" + ROLE_ASSUMERS_FILE);
        });
        // test/defaultRoleAssumers.spec.ts
        writerFactory.accept("test/" + ROLE_ASSUMERS_TEST_FILE + ".ts", writer -> {
            String resourceName = STS_CLIENT_PREFIX + ROLE_ASSUMERS_TEST_FILE + ".ts";
            writer
                .pushState()
                .putContext(Map.of(
                    "noTouchNoticePrefix", NO_TOUCH_NOTICE_PREFIX,
                    "resourceName", resourceName,
                    "body", IoUtils.readUtf8Resource(AwsTraitsUtils.class, resourceName)
                ))
                .write("""
                    ${noTouchNoticePrefix:L}${resourceName:L}
                    ${body:L}
                    """)
                .popState();
        });

        codegenContext.writerDelegator().useFileWriter(AuthUtils.HTTP_AUTH_SCHEME_PROVIDER_PATH, w -> {
            ServiceShape service = codegenContext.settings().getService(codegenContext.model());
            Symbol serviceSymbol = codegenContext.symbolProvider().toSymbol(service);
            w.addRelativeImport(serviceSymbol.getName(), null,
                Paths.get(".", serviceSymbol.getNamespace()));
            w.addRelativeImport(serviceSymbol.getName() + "Config", null,
                Paths.get(".", serviceSymbol.getNamespace()));
            w.write("export interface StsAuthInputConfig {}\n");
            w.openBlock("export interface StsAuthResolvedConfig {", "}\n", () -> w
                .writeDocs("""
                    Reference to STSClient class constructor.
                    @internal""")
                .addDependency(TypeScriptDependency.SMITHY_TYPES)
                .addImport("Client", null, TypeScriptDependency.SMITHY_TYPES)
                .write("stsClientCtor: new (clientConfig: any) => Client<any, any, any>;"));
            w.openBlock("""
                export const resolveStsAuthConfig = <T>(
                  input: T & StsAuthInputConfig
                ): T & StsAuthResolvedConfig => Object.assign(input, {
                """, "});", () -> {
                    w.write("""
                        stsClientCtor: STSClient,
                        """);
                });
        });
    }