@@ -169,8 +169,8 @@ describe("getProcessArnablesMiddleware", () => {
169
169
expect ( context ) . toMatchObject ( { signing_service : "s3-outposts" , signing_region : "us-gov-east-1" } ) ;
170
170
} ) ;
171
171
172
- it ( "should validate when arn region is fips region" , async ( ) => {
173
- expect . assertions ( 1 ) ;
172
+ it ( "should compute hostname for fips region" , async ( ) => {
173
+ expect . assertions ( 4 ) ;
174
174
const clientRegion = "us-gov-east-1" ;
175
175
const hostname = `s3-control.${ clientRegion } .amazonaws.com` ;
176
176
const options = setupPluginOptions ( {
@@ -181,36 +181,14 @@ describe("getProcessArnablesMiddleware", () => {
181
181
} ) ;
182
182
const stack = getStack ( hostname , options ) ;
183
183
const handler = stack . resolve ( ( ( ) => { } ) as any , { } ) ;
184
- try {
185
- await handler ( {
186
- input : {
187
- Name : "arn:aws-us-gov:s3-outposts:fips-us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
188
- } ,
189
- } ) ;
190
- } catch ( e ) {
191
- expect ( e . message ) . toContain ( "FIPS region is not supported" ) ;
192
- }
193
- } ) ;
194
-
195
- it ( "should update endpoint, headers and context correctly if client is fips region" , async ( ) => {
196
- expect . assertions ( 4 ) ;
197
- const clientRegion = "fip-us-gov-east-1" ;
198
- const hostname = `s3-control.${ clientRegion } .amazonaws.com` ;
199
- const options = setupPluginOptions ( {
200
- region : clientRegion ,
201
- useArnRegion : true ,
202
- regionInfoProvider : ( ) => Promise . resolve ( { hostname, partition : "aws-us-gov" } ) ,
203
- } ) ;
204
- const stack = getStack ( hostname , options ) ;
205
- const handler = stack . resolve ( ( ( ) => { } ) as any , { } ) ;
206
184
const {
207
185
output : { request, context, input } ,
208
186
} = ( await handler ( {
209
187
input : {
210
188
Name : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
211
189
} ,
212
190
} ) ) as any ;
213
- expect ( request . hostname ) . toBe ( "s3-outposts.us-gov-east-1.amazonaws.com" ) ;
191
+ expect ( request . hostname ) . toBe ( "s3-outposts-fips .us-gov-east-1.amazonaws.com" ) ;
214
192
expect ( request . headers ) . toMatchObject ( { "x-amz-outpost-id" : "op-01234567890123456" } ) ;
215
193
expect ( input . AccountId ) . toBe ( "123456789012" ) ;
216
194
expect ( context ) . toMatchObject ( { signing_service : "s3-outposts" , signing_region : "us-gov-east-1" } ) ;
@@ -391,8 +369,8 @@ describe("getProcessArnablesMiddleware", () => {
391
369
expect ( context ) . toMatchObject ( { signing_service : "s3-outposts" , signing_region : "us-gov-east-1" } ) ;
392
370
} ) ;
393
371
394
- it ( "should validate when arn region is fips region" , async ( ) => {
395
- expect . assertions ( 1 ) ;
372
+ it ( "should compute hostname for fips region" , async ( ) => {
373
+ expect . assertions ( 4 ) ;
396
374
const clientRegion = "us-gov-east-1" ;
397
375
const hostname = `s3-control.${ clientRegion } .amazonaws.com` ;
398
376
const options = setupPluginOptions ( {
@@ -403,16 +381,17 @@ describe("getProcessArnablesMiddleware", () => {
403
381
} ) ;
404
382
const stack = getStack ( hostname , options ) ;
405
383
const handler = stack . resolve ( ( ( ) => { } ) as any , { } ) ;
406
- try {
407
- await handler ( {
408
- input : {
409
- Bucket :
410
- "arn:aws-us-gov:s3-outposts:fips-us-gov-east-1:123456789012:outpost:op-01234567890123456:bucket:mybucket" ,
411
- } ,
412
- } ) ;
413
- } catch ( e ) {
414
- expect ( e . message ) . toContain ( "FIPS region is not supported" ) ;
415
- }
384
+ const {
385
+ output : { request, context, input } ,
386
+ } = ( await handler ( {
387
+ input : {
388
+ Bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:bucket:mybucket" ,
389
+ } ,
390
+ } ) ) as any ;
391
+ expect ( request . hostname ) . toBe ( "s3-outposts-fips.us-gov-east-1.amazonaws.com" ) ;
392
+ expect ( request . headers ) . toMatchObject ( { "x-amz-outpost-id" : "op-01234567890123456" } ) ;
393
+ expect ( input . AccountId ) . toBe ( "123456789012" ) ;
394
+ expect ( context ) . toMatchObject ( { signing_service : "s3-outposts" , signing_region : "us-gov-east-1" } ) ;
416
395
} ) ;
417
396
418
397
it ( "should update endpoint, headers and context correctly if client is fips region" , async ( ) => {
0 commit comments