Skip to content

Commit 2afbd3c

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

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

+20
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,15 @@ private void generateHttpAuthSchemeInputConfigInterface(
248248
w.write(" {");
249249
w.indent();
250250
w.addDependency(TypeScriptDependency.SMITHY_TYPES);
251+
252+
w.addImport("Provider", null, TypeScriptDependency.SMITHY_TYPES);
253+
w.writeDocs("""
254+
A comma-separated list of case-sensitive auth scheme names. \
255+
An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed. \
256+
For example, the auth scheme with ID aws.auth#sigv4 is named sigv4. \
257+
@public""");
258+
w.write("authSchemePreference?: string[] | Provider<string[]>;\n");
259+
251260
w.addImport("HttpAuthScheme", null, TypeScriptDependency.SMITHY_TYPES);
252261
w.writeDocs("""
253262
Configuration of HttpAuthSchemes for a client which provides \
@@ -314,6 +323,15 @@ private void generateHttpAuthSchemeResolvedConfigInterface(
314323
w.write(" {");
315324
w.indent();
316325
w.addDependency(TypeScriptDependency.SMITHY_TYPES);
326+
327+
w.addImport("Provider", null, TypeScriptDependency.SMITHY_TYPES);
328+
w.writeDocs("""
329+
A comma-separated list of case-sensitive auth scheme names. \
330+
An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed. \
331+
For example, the auth scheme with ID aws.auth#sigv4 is named sigv4. \
332+
@public""");
333+
w.write("readonly authSchemePreference: Provider<string[]>;\n");
334+
317335
w.addImport("HttpAuthScheme", null, TypeScriptDependency.SMITHY_TYPES);
318336
w.writeDocs("""
319337
Configuration of HttpAuthSchemes for a client which provides \
@@ -421,6 +439,8 @@ private void generateResolveHttpAuthSchemeConfigFunction(
421439
w.write("return Object.assign(");
422440
w.indent();
423441
w.write("$L, {", configName);
442+
w.addImport("normalizeProvider", null, TypeScriptDependency.UTIL_MIDDLEWARE);
443+
w.write("authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),");
424444
for (ConfigField configField : configFields.values()) {
425445
if (configField.configFieldWriter().isPresent()) {
426446
w.write("$L,", configField.name());

0 commit comments

Comments
 (0)