1
1
import { HttpRequest } from "@aws-sdk/protocol-http" ;
2
2
import {
3
- Command ,
4
3
FinalizeHandler ,
5
4
FinalizeHandlerArguments ,
6
5
FinalizeHandlerOutput ,
@@ -23,7 +22,7 @@ export const endpointDiscoveryMiddlewareOptions: FinalizeRequestHandlerOptions =
23
22
24
23
export type EndpointDiscoveryMiddlewareConfig = {
25
24
isDiscoveredEndpointRequired : boolean ;
26
- endpointDiscoveryId ?: string ;
25
+ identifiers ?: Map < String , String > ;
27
26
} ;
28
27
29
28
export const endpointDiscoveryMiddleware = (
@@ -37,7 +36,7 @@ export const endpointDiscoveryMiddleware = (
37
36
) : Promise < FinalizeHandlerOutput < Output > > => {
38
37
const { client } = config ;
39
38
const { endpointDiscoveryCommandCtor } = client ?. config ;
40
- const { isDiscoveredEndpointRequired, endpointDiscoveryId } = middlewareConfig ;
39
+ const { isDiscoveredEndpointRequired, identifiers } = middlewareConfig ;
41
40
const { commandName } = context ;
42
41
43
42
if ( isDiscoveredEndpointRequired === true ) {
@@ -46,20 +45,20 @@ export const endpointDiscoveryMiddleware = (
46
45
await updateDiscoveredEndpointInCache ( config , {
47
46
commandName,
48
47
endpointDiscoveryCommandCtor,
49
- endpointDiscoveryId ,
48
+ identifiers ,
50
49
} ) ;
51
50
} else if ( isDiscoveredEndpointRequired === false ) {
52
51
// Do not call await await on Endpoint Discovery API utility so that function
53
52
// does not block, the command will use discovered endpoint, if available.
54
53
updateDiscoveredEndpointInCache ( config , {
55
54
commandName,
56
55
endpointDiscoveryCommandCtor,
57
- endpointDiscoveryId ,
56
+ identifiers ,
58
57
} ) ;
59
58
}
60
59
61
60
const { request } = args ;
62
- const cacheKey = await getCacheKey ( commandName , client ?. config , { endpointDiscoveryId } ) ;
61
+ const cacheKey = await getCacheKey ( commandName , client ?. config , { identifiers } ) ;
63
62
if ( cacheKey && HttpRequest . isInstance ( request ) ) {
64
63
const endpoints = client ?. config . endpointCache . get ( cacheKey ) ;
65
64
if ( endpoints && endpoints . length > 0 ) {
0 commit comments