Skip to content

Add authSchemePreference client config #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ private void generateHttpAuthSchemeInputConfigInterface(
w.write(" {");
w.indent();
w.addDependency(TypeScriptDependency.SMITHY_TYPES);

w.addImport("Provider", null, TypeScriptDependency.SMITHY_TYPES);
w.writeDocs("""
A comma-separated list of case-sensitive auth scheme names.
An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed.
For example, the auth scheme with ID aws.auth#sigv4 is named sigv4.
@public""");
w.write("authSchemePreference?: string[] | Provider<string[]>;\n");

w.addImport("HttpAuthScheme", null, TypeScriptDependency.SMITHY_TYPES);
w.writeDocs("""
Configuration of HttpAuthSchemes for a client which provides \
Expand Down Expand Up @@ -314,6 +323,15 @@ private void generateHttpAuthSchemeResolvedConfigInterface(
w.write(" {");
w.indent();
w.addDependency(TypeScriptDependency.SMITHY_TYPES);

w.addImport("Provider", null, TypeScriptDependency.SMITHY_TYPES);
w.writeDocs("""
A comma-separated list of case-sensitive auth scheme names.
An auth scheme name is a fully qualified auth scheme ID with the namespace prefix trimmed.
For example, the auth scheme with ID aws.auth#sigv4 is named sigv4.
@public""");
w.write("readonly authSchemePreference: Provider<string[]>;\n");

w.addImport("HttpAuthScheme", null, TypeScriptDependency.SMITHY_TYPES);
w.writeDocs("""
Configuration of HttpAuthSchemes for a client which provides \
Expand Down Expand Up @@ -421,6 +439,8 @@ private void generateResolveHttpAuthSchemeConfigFunction(
w.write("return Object.assign(");
w.indent();
w.write("$L, {", configName);
w.addImport("normalizeProvider", null, TypeScriptDependency.UTIL_MIDDLEWARE);
w.write("authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),");
for (ConfigField configField : configFields.values()) {
if (configField.configFieldWriter().isPresent()) {
w.write("$L,", configField.name());
Expand Down