@@ -85,20 +85,24 @@ public void run() {
85
85
}
86
86
87
87
/*
88
- export interface WeatherHttpAuthSchemeParameters {
89
- operation?: string;
88
+ import { HttpAuthSchemeParameters } from "@smithy/types";
89
+
90
+ // ...
91
+
92
+ export interface WeatherHttpAuthSchemeParameters extends HttpAuthSchemeParameters {
90
93
}
91
94
*/
92
95
private void generateHttpAuthSchemeParametersInterface () {
93
96
delegator .useFileWriter (AuthUtils .HTTP_AUTH_SCHEME_PROVIDER_PATH , w -> {
97
+ w .addDependency (TypeScriptDependency .EXPERIMENTAL_IDENTITY_AND_AUTH );
98
+ w .addImport ("HttpAuthSchemeParameters" , null , TypeScriptDependency .EXPERIMENTAL_IDENTITY_AND_AUTH );
94
99
w .openBlock ("""
95
100
/**
96
101
* @internal
97
102
*/
98
- export interface $LHttpAuthSchemeParameters {""" , "}" ,
103
+ export interface $LHttpAuthSchemeParameters extends HttpAuthSchemeParameters {""" , "}" ,
99
104
serviceName ,
100
105
() -> {
101
- w .write ("operation?: string;" );
102
106
for (HttpAuthScheme authScheme : authIndex .getSupportedHttpAuthSchemes ().values ()) {
103
107
for (HttpAuthSchemeParameter parameter : authScheme .getHttpAuthSchemeParameters ()) {
104
108
w .write ("$L?: $C;" , parameter .name (), parameter .type ());
@@ -110,32 +114,31 @@ export interface $LHttpAuthSchemeParameters {""", "}",
110
114
111
115
/*
112
116
import { WeatherClientResolvedConfig } from "../WeatherClient";
113
- import { HandlerExecutionContext } from "@smithy/types";
117
+ import { HttpAuthSchemeParametersProvider } from "@smithy/types";
114
118
115
119
// ...
116
120
117
- export async function defaultWeatherHttpAuthSchemeParametersProvider(
118
- config: WeatherClientResolvedConfig,
119
- context: HandlerExecutionContext
120
- ): Promise<WeatherHttpAuthSchemeParameters> {
121
- return {
122
- operation: context.commandName,
123
- };
121
+ export const defaultWeatherHttpAuthSchemeParametersProvider:
122
+ HttpAuthSchemeParametersProvider<WeatherClientResolvedConfig, WeatherHttpAuthSchemeParameters> =
123
+ async (config, context) => {
124
+ return {
125
+ operation: context.commandName,
126
+ };
124
127
};
125
128
*/
126
129
private void generateDefaultHttpAuthSchemeParametersProviderFunction () {
127
130
delegator .useFileWriter (AuthUtils .HTTP_AUTH_SCHEME_PROVIDER_PATH , w -> {
128
131
w .addRelativeImport (serviceSymbol .getName () + "ResolvedConfig" , null ,
129
132
Paths .get ("." , serviceSymbol .getNamespace ()));
130
- w .addImport ("HandlerExecutionContext" , null , TypeScriptDependency .SMITHY_TYPES );
133
+ w .addDependency (TypeScriptDependency .EXPERIMENTAL_IDENTITY_AND_AUTH );
134
+ w .addImport ("HttpAuthSchemeParametersProvider" , null , TypeScriptDependency .EXPERIMENTAL_IDENTITY_AND_AUTH );
131
135
w .openBlock ("""
132
136
/**
133
137
* @internal
134
138
*/
135
- export async function default$LHttpAuthSchemeParametersProvider(
136
- config: $LResolvedConfig,
137
- context: HandlerExecutionContext
138
- ): Promise<$LHttpAuthSchemeParameters> {""" , "};" ,
139
+ export const default$LHttpAuthSchemeParametersProvider: \
140
+ HttpAuthSchemeParametersProvider<$LResolvedConfig, $LHttpAuthSchemeParameters> = \
141
+ async (config, context) => {""" , "};" ,
139
142
serviceName , serviceSymbol .getName (), serviceName ,
140
143
() -> {
141
144
w .openBlock ("return {" , "};" , () -> {
@@ -223,26 +226,28 @@ private static String normalizeAuthSchemeName(ShapeId shapeId) {
223
226
}
224
227
225
228
/*
226
- export interface WeatherHttpAuthSchemeProvider {
227
- (authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption[];
228
- }
229
+ import { HttpAuthSchemeProvider } from "@smithy/types";
230
+
231
+ // ...
232
+
233
+ export interface WeatherHttpAuthSchemeProvider extends HttpAuthSchemeProvider<WeatherHttpAuthSchemeParameters> {}
229
234
*/
230
235
private void generateHttpAuthSchemeProviderInterface () {
231
236
delegator .useFileWriter (AuthUtils .HTTP_AUTH_SCHEME_PROVIDER_PATH , w -> {
237
+ w .addDependency (TypeScriptDependency .EXPERIMENTAL_IDENTITY_AND_AUTH );
238
+ w .addImport ("HttpAuthSchemeProvider" , null , TypeScriptDependency .EXPERIMENTAL_IDENTITY_AND_AUTH );
232
239
w .write ("""
233
240
/**
234
241
* @internal
235
242
*/
236
- export interface $LHttpAuthSchemeProvider {
237
- (authParameters: $LHttpAuthSchemeParameters): HttpAuthOption[];
238
- }
243
+ export interface $LHttpAuthSchemeProvider extends HttpAuthSchemeProvider<$LHttpAuthSchemeParameters> {}
239
244
""" , serviceName , serviceName );
240
245
});
241
246
}
242
247
243
248
/*
244
- export function defaultWeatherHttpAuthSchemeProvider(authParameters: WeatherHttpAuthSchemeParameters):
245
- HttpAuthOption[] {
249
+ export const defaultWeatherHttpAuthSchemeProvider: WeatherHttpAuthSchemeProvider =
250
+ (authParameters) => {
246
251
const options: HttpAuthOption[] = [];
247
252
switch (authParameters.operation) {
248
253
default: {
@@ -258,8 +263,9 @@ private void generateHttpAuthSchemeProviderDefaultFunction() {
258
263
/**
259
264
* @internal
260
265
*/
261
- export function default$LHttpAuthSchemeProvider(authParameters: $LHttpAuthSchemeParameters): \
262
- HttpAuthOption[] {""" , "};" , serviceName , serviceName , () -> {
266
+ export const default$LHttpAuthSchemeProvider: $LHttpAuthSchemeProvider = \
267
+ (authParameters) => {""" , "};" ,
268
+ serviceName , serviceName , () -> {
263
269
w .write ("const options: HttpAuthOption[] = [];" );
264
270
w .openBlock ("switch (authParameters.operation) {" , "};" , () -> {
265
271
var serviceAuthSchemes = serviceIndex .getEffectiveAuthSchemes (
0 commit comments