Skip to content

Commit f69770d

Browse files
committed
Add authSchemePreference client config
1 parent 8dec179 commit f69770d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/auth/http/integration/AddHttpAuthSchemePlugin.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ private void generateHttpAuthSchemeInputConfigInterface(
248248
w.write(" {");
249249
w.indent();
250250
w.addDependency(TypeScriptDependency.SMITHY_TYPES);
251+
252+
w.writeDocs("""
253+
A comma-separated list of case-sensitive auth scheme names. \
254+
An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed. \
255+
For example, the auth scheme with ID aws.auth#sigv4 is named sigv4. \
256+
@public""");
257+
w.write("authSchemePreference?: string[] | Provider<string[]>;\n");
258+
251259
w.addImport("HttpAuthScheme", null, TypeScriptDependency.SMITHY_TYPES);
252260
w.writeDocs("""
253261
Configuration of HttpAuthSchemes for a client which provides \
@@ -314,6 +322,14 @@ private void generateHttpAuthSchemeResolvedConfigInterface(
314322
w.write(" {");
315323
w.indent();
316324
w.addDependency(TypeScriptDependency.SMITHY_TYPES);
325+
326+
w.writeDocs("""
327+
A comma-separated list of case-sensitive auth scheme names. \
328+
An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed. \
329+
For example, the auth scheme with ID aws.auth#sigv4 is named sigv4. \
330+
@public""");
331+
w.write("readonly authSchemePreference: Provider<string[]>;\n");
332+
317333
w.addImport("HttpAuthScheme", null, TypeScriptDependency.SMITHY_TYPES);
318334
w.writeDocs("""
319335
Configuration of HttpAuthSchemes for a client which provides \
@@ -421,6 +437,8 @@ private void generateResolveHttpAuthSchemeConfigFunction(
421437
w.write("return Object.assign(");
422438
w.indent();
423439
w.write("$L, {", configName);
440+
w.addImport("normalizeProvider", null, TypeScriptDependency.UTIL_MIDDLEWARE);
441+
w.write("authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),");
424442
for (ConfigField configField : configFields.values()) {
425443
if (configField.configFieldWriter().isPresent()) {
426444
w.write("$L,", configField.name());

0 commit comments

Comments
 (0)