@@ -8,7 +8,7 @@ describe("S3Control Client", () => {
88 // Middleware intercept request and return it before reaching the HTTP client. It records the request and context
99 // and return them in the Metadata.
1010 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 } ) ;
1212 } ;
1313 const region = "us-east-1" ;
1414 const credentials = { accessKeyId : "AKID" , secretAccessKey : "SECRET" } ;
@@ -30,14 +30,14 @@ describe("S3Control Client", () => {
3030 ) ;
3131 } ) ;
3232
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 ( ) => {
3534 const OutpostId = "123456789012" ;
3635 const {
3736 // @ts -ignore request is set in $metadata by interception middleware.
3837 $metadata : { request } ,
3938 } = await s3Control . createBucket ( { Bucket : "Bucket" , OutpostId } ) ;
4039 expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
40+
4141 expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
4242 expect ( request . headers [ "authorization" ] ) . contains (
4343 `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3-outposts/aws4_request`
@@ -58,14 +58,13 @@ describe("S3Control Client", () => {
5858 ) ;
5959 } ) ;
6060
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 ( ) => {
6362 const OutpostId = "123456789012" ;
6463 const {
6564 // @ts -ignore request is set in $metadata by interception middleware.
6665 $metadata : { request } ,
6766 } = 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` ) ;
6968 expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
7069 expect ( request . headers [ HEADER_ACCOUNT_ID ] ) . eql ( AccountId ) ;
7170 expect ( request . headers [ "authorization" ] ) . contains (
@@ -90,17 +89,17 @@ describe("S3Control Client", () => {
9089 ) ;
9190 } ) ;
9291
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 ( ) => {
9593 const {
9694 // @ts -ignore request is set in $metadata by interception middleware.
9795 $metadata : { request } ,
98- } = await s3Control . getAccessPoint ( { Name : accesspointArn } ) ;
96+ } = await s3Control . getAccessPoint ( { Name : accesspointArn , AccountId } ) ;
97+
9998 expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
10099 expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
101100 expect ( request . headers [ HEADER_ACCOUNT_ID ] ) . eql ( AccountId ) ;
102101 expect ( request . headers [ "authorization" ] ) . contains (
103- `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3-outposts /aws4_request`
102+ `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3/aws4_request`
104103 ) ;
105104 } ) ;
106105 } ) ;
@@ -121,17 +120,17 @@ describe("S3Control Client", () => {
121120 ) ;
122121 } ) ;
123122
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 ( ) => {
126124 const {
127125 // @ts -ignore request is set in $metadata by interception middleware.
128126 $metadata : { request } ,
129127 } = await s3Control . getBucket ( { Bucket : bucketArn } ) ;
128+
130129 expect ( request . hostname ) . eql ( `s3-outposts.${ region } .amazonaws.com` ) ;
131130 expect ( request . headers [ HEADER_OUTPOST_ID ] ) . eql ( OutpostId ) ;
132131 expect ( request . headers [ HEADER_ACCOUNT_ID ] ) . eql ( AccountId ) ;
133132 expect ( request . headers [ "authorization" ] ) . contains (
134- `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3-outposts /aws4_request`
133+ `Credential=${ credentials . accessKeyId } /${ dateStr } /${ region } /s3/aws4_request`
135134 ) ;
136135 } ) ;
137136 } ) ;
0 commit comments