@@ -8,7 +8,7 @@ describe("S3Control Client", () => {
8
8
// Middleware intercept request and return it before reaching the HTTP client. It records the request and context
9
9
// and return them in the Metadata.
10
10
const interceptionMiddleware : FinalizeRequestMiddleware < any , any > = ( next , context ) => ( args ) => {
11
- return Promise . resolve ( { output : { $metadata : { request : args . request } } , response : "" as any } ) ;
11
+ return Promise . resolve ( { output : { $metadata : { request : args . request , context } } , response : "" as any } ) ;
12
12
} ;
13
13
const region = "us-east-1" ;
14
14
const credentials = { accessKeyId : "AKID" , secretAccessKey : "SECRET" } ;
@@ -30,14 +30,14 @@ describe("S3Control Client", () => {
30
30
) ;
31
31
} ) ;
32
32
33
- // TODO(endpointsv2)
34
- it . skip ( "should populate correct endpoint and signing region if OutpostId is supplied" , async ( ) => {
33
+ it ( "should populate correct endpoint and signing region if OutpostId is supplied" , async ( ) => {
35
34
const OutpostId = "123456789012" ;
36
35
const {
37
36
// @ts -ignore request is set in $metadata by interception middleware.
38
37
$metadata : { request } ,
39
38
} = await s3Control . createBucket ( { Bucket : "Bucket" , OutpostId } ) ;
40
39
expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
40
+
41
41
expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
42
42
expect ( request . headers [ "authorization" ] ) . contains (
43
43
`Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3-outposts/aws4_request`
@@ -58,14 +58,13 @@ describe("S3Control Client", () => {
58
58
) ;
59
59
} ) ;
60
60
61
- // TODO(endpointsv2)
62
- it . skip ( "should populate correct endpoint and signing region if OutpostId is supplied" , async ( ) => {
61
+ it ( "should populate correct endpoint and signing region if OutpostId is supplied" , async ( ) => {
63
62
const OutpostId = "123456789012" ;
64
63
const {
65
64
// @ts -ignore request is set in $metadata by interception middleware.
66
65
$metadata : { request } ,
67
66
} = await s3Control . listRegionalBuckets ( { AccountId, OutpostId } ) ;
68
- expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
67
+ expect ( request . hostname ) . contains ( `s3-outposts.${ region } .amazonaws.com` ) ;
69
68
expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
70
69
expect ( request . headers [ HEADER_ACCOUNT_ID ] ) . eql ( AccountId ) ;
71
70
expect ( request . headers [ "authorization" ] ) . contains (
@@ -90,17 +89,17 @@ describe("S3Control Client", () => {
90
89
) ;
91
90
} ) ;
92
91
93
- // TODO(endpointsv2)
94
- it . skip ( "should populate correct endpoint and signing region if Access Point name is ARN" , async ( ) => {
92
+ it ( "should populate correct endpoint and signing region if Access Point name is ARN" , async ( ) => {
95
93
const {
96
94
// @ts -ignore request is set in $metadata by interception middleware.
97
95
$metadata : { request } ,
98
- } = await s3Control . getAccessPoint ( { Name : accesspointArn } ) ;
96
+ } = await s3Control . getAccessPoint ( { Name : accesspointArn , AccountId } ) ;
97
+
99
98
expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
100
99
expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
101
100
expect ( request . headers [ HEADER_ACCOUNT_ID ] ) . eql ( AccountId ) ;
102
101
expect ( request . headers [ "authorization" ] ) . contains (
103
- `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3-outposts /aws4_request`
102
+ `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3/aws4_request`
104
103
) ;
105
104
} ) ;
106
105
} ) ;
@@ -121,17 +120,17 @@ describe("S3Control Client", () => {
121
120
) ;
122
121
} ) ;
123
122
124
- // TODO(endpointsv2)
125
- it . skip ( "should populate correct endpoint and signing region if Bucket name is ARN" , async ( ) => {
123
+ it ( "should populate correct endpoint and signing region if Bucket name is ARN" , async ( ) => {
126
124
const {
127
125
// @ts -ignore request is set in $metadata by interception middleware.
128
126
$metadata : { request } ,
129
127
} = await s3Control . getBucket ( { Bucket : bucketArn } ) ;
128
+
130
129
expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
131
130
expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
132
131
expect ( request . headers [ HEADER_ACCOUNT_ID ] ) . eql ( AccountId ) ;
133
132
expect ( request . headers [ "authorization" ] ) . contains (
134
- `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3-outposts /aws4_request`
133
+ `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3/aws4_request`
135
134
) ;
136
135
} ) ;
137
136
} ) ;
0 commit comments