@@ -5,12 +5,10 @@ import {
5
5
BucketHostnameParams ,
6
6
DOT_PATTERN ,
7
7
getArnResources ,
8
- getPseudoRegion ,
9
8
getSuffix ,
10
9
getSuffixForArnEndpoint ,
11
10
isBucketNameOptions ,
12
11
isDnsCompatibleBucketName ,
13
- isFipsRegion ,
14
12
validateAccountId ,
15
13
validateArnEndpointOptions ,
16
14
validateCustomEndpoint ,
@@ -48,6 +46,7 @@ const getEndpointFromBucketName = ({
48
46
baseHostname,
49
47
bucketName,
50
48
dualstackEndpoint = false ,
49
+ fipsEndpoint = false ,
51
50
pathStyleEndpoint = false ,
52
51
tlsCompatible = true ,
53
52
isCustomEndpoint = false ,
@@ -79,6 +78,7 @@ const getEndpointFromArn = (options: ArnHostnameParams): BucketHostname => {
79
78
const {
80
79
pathStyleEndpoint,
81
80
accelerateEndpoint = false ,
81
+ fipsEndpoint = false ,
82
82
tlsCompatible = true ,
83
83
bucketName,
84
84
clientPartition = "aws" ,
@@ -106,6 +106,7 @@ const getEndpointFromArn = (options: ArnHostnameParams): BucketHostname => {
106
106
107
107
const getEndpointFromObjectLambdaArn = ( {
108
108
dualstackEndpoint = false ,
109
+ fipsEndpoint = false ,
109
110
tlsCompatible = true ,
110
111
useArnRegion,
111
112
clientRegion,
@@ -120,7 +121,13 @@ const getEndpointFromObjectLambdaArn = ({
120
121
} ) : BucketHostname => {
121
122
const { accountId, region, service } = bucketName ;
122
123
validateRegionalClient ( clientRegion ) ;
123
- validateRegion ( region , { useArnRegion, clientRegion, clientSigningRegion, allowFipsRegion : true } ) ;
124
+ validateRegion ( region , {
125
+ useArnRegion,
126
+ clientRegion,
127
+ clientSigningRegion,
128
+ allowFipsRegion : true ,
129
+ useFipsEndpoint : fipsEndpoint ,
130
+ } ) ;
124
131
validateNoDualstack ( dualstackEndpoint ) ;
125
132
const DNSHostLabel = `${ accesspointName } -${ accountId } ` ;
126
133
validateDNSHostLabel ( DNSHostLabel , { tlsCompatible } ) ;
@@ -130,9 +137,7 @@ const getEndpointFromObjectLambdaArn = ({
130
137
131
138
return {
132
139
bucketEndpoint : true ,
133
- hostname : `${ DNSHostLabel } .${ service } ${ isFipsRegion ( clientRegion ) ? "-fips" : "" } .${ getPseudoRegion (
134
- endpointRegion
135
- ) } .${ hostnameSuffix } `,
140
+ hostname : `${ DNSHostLabel } .${ service } ${ fipsEndpoint ? "-fips" : "" } .${ endpointRegion } .${ hostnameSuffix } ` ,
136
141
signingRegion,
137
142
signingService : service ,
138
143
} ;
@@ -165,22 +170,23 @@ const getEndpointFromOutpostArn = ({
165
170
bucketName,
166
171
outpostId,
167
172
dualstackEndpoint = false ,
173
+ fipsEndpoint = false ,
168
174
tlsCompatible = true ,
169
175
accesspointName,
170
176
isCustomEndpoint,
171
177
hostnameSuffix,
172
178
} : ArnHostnameParams & { outpostId : string ; accesspointName : string ; hostnameSuffix : string } ) : BucketHostname => {
173
179
// if this is an Outpost ARN
174
180
validateRegionalClient ( clientRegion ) ;
175
- validateRegion ( bucketName . region , { useArnRegion, clientRegion, clientSigningRegion } ) ;
181
+ validateRegion ( bucketName . region , { useArnRegion, clientRegion, clientSigningRegion, useFipsEndpoint : fipsEndpoint } ) ;
176
182
const DNSHostLabel = `${ accesspointName } -${ bucketName . accountId } ` ;
177
183
validateDNSHostLabel ( DNSHostLabel , { tlsCompatible } ) ;
178
184
const endpointRegion = useArnRegion ? bucketName . region : clientRegion ;
179
185
const signingRegion = useArnRegion ? bucketName . region : clientSigningRegion ;
180
186
validateOutpostService ( bucketName . service ) ;
181
187
validateDNSHostLabel ( outpostId , { tlsCompatible } ) ;
182
188
validateNoDualstack ( dualstackEndpoint ) ;
183
- validateNoFIPS ( endpointRegion ) ;
189
+ validateNoFIPS ( fipsEndpoint ) ;
184
190
const hostnamePrefix = `${ DNSHostLabel } .${ outpostId } ` ;
185
191
return {
186
192
bucketEndpoint : true ,
@@ -196,14 +202,21 @@ const getEndpointFromAccessPointArn = ({
196
202
clientSigningRegion = clientRegion ,
197
203
bucketName,
198
204
dualstackEndpoint = false ,
205
+ fipsEndpoint = false ,
199
206
tlsCompatible = true ,
200
207
accesspointName,
201
208
isCustomEndpoint,
202
209
hostnameSuffix,
203
210
} : ArnHostnameParams & { accesspointName : string ; hostnameSuffix : string } ) : BucketHostname => {
204
211
// construct endpoint from Accesspoint ARN
205
212
validateRegionalClient ( clientRegion ) ;
206
- validateRegion ( bucketName . region , { useArnRegion, clientRegion, clientSigningRegion, allowFipsRegion : true } ) ;
213
+ validateRegion ( bucketName . region , {
214
+ useArnRegion,
215
+ clientRegion,
216
+ clientSigningRegion,
217
+ allowFipsRegion : true ,
218
+ useFipsEndpoint : fipsEndpoint ,
219
+ } ) ;
207
220
const hostnamePrefix = `${ accesspointName } -${ bucketName . accountId } ` ;
208
221
validateDNSHostLabel ( hostnamePrefix , { tlsCompatible } ) ;
209
222
const endpointRegion = useArnRegion ? bucketName . region : clientRegion ;
@@ -214,9 +227,7 @@ const getEndpointFromAccessPointArn = ({
214
227
hostname : `${ hostnamePrefix } ${
215
228
isCustomEndpoint
216
229
? ""
217
- : `.s3-accesspoint${ isFipsRegion ( clientRegion ) ? "-fips" : "" } ${
218
- dualstackEndpoint ? ".dualstack" : ""
219
- } .${ getPseudoRegion ( endpointRegion ) } `
230
+ : `.s3-accesspoint${ fipsEndpoint ? "-fips" : "" } ${ dualstackEndpoint ? ".dualstack" : "" } .${ endpointRegion } `
220
231
} .${ hostnameSuffix } `,
221
232
signingRegion,
222
233
} ;
0 commit comments