@@ -134,6 +134,7 @@ func TestEndpointWithARN(t *testing.T) {
134
134
cases := map [string ]struct {
135
135
options s3control.Options
136
136
bucket string
137
+ accessPoint string
137
138
expectedErr string
138
139
expectedReqURL string
139
140
expectedSigningName string
@@ -142,163 +143,163 @@ func TestEndpointWithARN(t *testing.T) {
142
143
expectedHeaderForAccountID bool
143
144
}{
144
145
"Outpost AccessPoint with no S3UseARNRegion flag set" : {
145
- bucket : "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
146
+ accessPoint : "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
146
147
options : s3control.Options {
147
148
Region : "us-west-2" ,
148
149
},
149
- expectedReqURL : "https://s3-outposts.us-west-2.amazonaws.com/v20180820/bucket /myaccesspoint" ,
150
+ expectedReqURL : "https://s3-outposts.us-west-2.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
150
151
expectedSigningName : "s3-outposts" ,
151
152
expectedSigningRegion : "us-west-2" ,
152
153
expectedHeaderForAccountID : true ,
153
154
expectedHeaderForOutpostID : "op-01234567890123456" ,
154
155
},
155
156
"Outpost AccessPoint Cross-Region Enabled" : {
156
- bucket : "arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
157
+ accessPoint : "arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
157
158
options : s3control.Options {
158
159
Region : "us-west-2" ,
159
160
UseARNRegion : true ,
160
161
},
161
- expectedReqURL : "https://s3-outposts.us-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
162
+ expectedReqURL : "https://s3-outposts.us-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
162
163
expectedSigningName : "s3-outposts" ,
163
164
expectedSigningRegion : "us-east-1" ,
164
165
expectedHeaderForAccountID : true ,
165
166
expectedHeaderForOutpostID : "op-01234567890123456" ,
166
167
},
167
168
"Outpost AccessPoint Cross-Region Disabled" : {
168
- bucket : "arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
169
+ accessPoint : "arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
169
170
options : s3control.Options {
170
171
Region : "us-west-2" ,
171
172
},
172
173
expectedErr : "client region does not match provided ARN region" ,
173
174
},
174
175
"Outpost AccessPoint other partition" : {
175
- bucket : "arn:aws-cn:s3-outposts:cn-north-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
176
+ accessPoint : "arn:aws-cn:s3-outposts:cn-north-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
176
177
options : s3control.Options {
177
178
Region : "us-west-2" ,
178
179
UseARNRegion : true ,
179
180
},
180
181
expectedErr : "ConfigurationError : client partition does not match provided ARN partition" ,
181
182
},
182
183
"Outpost AccessPoint us-gov region" : {
183
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
184
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
184
185
options : s3control.Options {
185
186
Region : "us-gov-east-1" ,
186
187
UseARNRegion : true ,
187
188
},
188
- expectedReqURL : "https://s3-outposts.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
189
+ expectedReqURL : "https://s3-outposts.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
189
190
expectedSigningName : "s3-outposts" ,
190
191
expectedSigningRegion : "us-gov-east-1" ,
191
192
expectedHeaderForAccountID : true ,
192
193
expectedHeaderForOutpostID : "op-01234567890123456" ,
193
194
},
194
195
"Outpost AccessPoint with client region as FIPS" : {
195
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
196
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
196
197
options : s3control.Options {
197
198
Region : "us-gov-east-1" ,
198
199
EndpointOptions : s3control.EndpointResolverOptions {
199
200
UseFIPSEndpoint : aws .FIPSEndpointStateEnabled ,
200
201
},
201
202
},
202
- expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
203
+ expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
203
204
expectedSigningName : "s3-outposts" ,
204
205
expectedSigningRegion : "us-gov-east-1" ,
205
206
expectedHeaderForOutpostID : "op-01234567890123456" ,
206
207
expectedHeaderForAccountID : true ,
207
208
},
208
209
"Outpost AccessPoint with client region as FIPS (ResolvedRegion)" : {
209
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
210
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
210
211
options : s3control.Options {
211
212
Region : "us-gov-east-1-fips" ,
212
213
},
213
- expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
214
+ expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
214
215
expectedSigningName : "s3-outposts" ,
215
216
expectedSigningRegion : "us-gov-east-1" ,
216
217
expectedHeaderForOutpostID : "op-01234567890123456" ,
217
218
expectedHeaderForAccountID : true ,
218
219
},
219
220
"Outpost AccessPoint with client FIPS and use arn region enabled" : {
220
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
221
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
221
222
options : s3control.Options {
222
223
Region : "us-gov-east-1" ,
223
224
EndpointOptions : s3control.EndpointResolverOptions {
224
225
UseFIPSEndpoint : aws .FIPSEndpointStateEnabled ,
225
226
},
226
227
UseARNRegion : true ,
227
228
},
228
- expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
229
+ expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
229
230
expectedSigningName : "s3-outposts" ,
230
231
expectedSigningRegion : "us-gov-east-1" ,
231
232
expectedHeaderForOutpostID : "op-01234567890123456" ,
232
233
expectedHeaderForAccountID : true ,
233
234
},
234
235
"Outpost AccessPoint with client FIPS (ResolvedRegion) and use arn region enabled" : {
235
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
236
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
236
237
options : s3control.Options {
237
238
Region : "us-gov-east-1-fips" ,
238
239
UseARNRegion : true ,
239
240
},
240
- expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
241
+ expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
241
242
expectedSigningName : "s3-outposts" ,
242
243
expectedSigningRegion : "us-gov-east-1" ,
243
244
expectedHeaderForOutpostID : "op-01234567890123456" ,
244
245
expectedHeaderForAccountID : true ,
245
246
},
246
247
"Outpost AccessPoint client FIPS and cross region ARN" : {
247
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-west-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
248
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-west-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
248
249
options : s3control.Options {
249
250
Region : "us-gov-east-1" ,
250
251
UseARNRegion : true ,
251
252
EndpointOptions : s3control.EndpointResolverOptions {
252
253
UseFIPSEndpoint : aws .FIPSEndpointStateEnabled ,
253
254
},
254
255
},
255
- expectedReqURL : "https://s3-outposts-fips.us-gov-west-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
256
+ expectedReqURL : "https://s3-outposts-fips.us-gov-west-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
256
257
expectedSigningName : "s3-outposts" ,
257
258
expectedSigningRegion : "us-gov-west-1" ,
258
259
expectedHeaderForOutpostID : "op-01234567890123456" ,
259
260
expectedHeaderForAccountID : true ,
260
261
},
261
262
"Outpost AccessPoint client FIPS (ResolvedRegion) and cross region ARN" : {
262
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-west-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
263
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-west-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
263
264
options : s3control.Options {
264
265
Region : "us-gov-east-1-fips" ,
265
266
UseARNRegion : true ,
266
267
},
267
- expectedReqURL : "https://s3-outposts-fips.us-gov-west-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
268
+ expectedReqURL : "https://s3-outposts-fips.us-gov-west-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
268
269
expectedSigningName : "s3-outposts" ,
269
270
expectedSigningRegion : "us-gov-west-1" ,
270
271
expectedHeaderForOutpostID : "op-01234567890123456" ,
271
272
expectedHeaderForAccountID : true ,
272
273
},
273
274
"Outpost AccessPoint client FIPS with valid ARN region" : {
274
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
275
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
275
276
options : s3control.Options {
276
277
Region : "us-gov-east-1" ,
277
278
EndpointOptions : s3control.EndpointResolverOptions {
278
279
UseFIPSEndpoint : aws .FIPSEndpointStateEnabled ,
279
280
},
280
281
UseARNRegion : true ,
281
282
},
282
- expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
283
+ expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
283
284
expectedSigningName : "s3-outposts" ,
284
285
expectedSigningRegion : "us-gov-east-1" ,
285
286
expectedHeaderForOutpostID : "op-01234567890123456" ,
286
287
expectedHeaderForAccountID : true ,
287
288
},
288
289
"Outpost AccessPoint client FIPS (ResolvedRegion) with valid ARN region" : {
289
- bucket : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
290
+ accessPoint : "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
290
291
options : s3control.Options {
291
292
Region : "us-gov-east-1-fips" ,
292
293
UseARNRegion : true ,
293
294
},
294
- expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/bucket /myaccesspoint" ,
295
+ expectedReqURL : "https://s3-outposts-fips.us-gov-east-1.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
295
296
expectedSigningName : "s3-outposts" ,
296
297
expectedSigningRegion : "us-gov-east-1" ,
297
298
expectedHeaderForOutpostID : "op-01234567890123456" ,
298
299
expectedHeaderForAccountID : true ,
299
300
},
300
301
"Outpost AccessPoint with DualStack" : {
301
- bucket : "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
302
+ accessPoint : "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint" ,
302
303
options : s3control.Options {
303
304
Region : "us-west-2" ,
304
305
UseARNRegion : true ,
@@ -321,24 +322,24 @@ func TestEndpointWithARN(t *testing.T) {
321
322
expectedErr : "incomplete outpost resource type" ,
322
323
},
323
324
"access point" : {
324
- bucket : "myaccesspoint" ,
325
+ accessPoint : "myaccesspoint" ,
325
326
options : s3control.Options {
326
327
Region : "us-west-2" ,
327
328
},
328
- expectedReqURL : "https://123456789012.s3-control.us-west-2.amazonaws.com/v20180820/bucket /myaccesspoint" ,
329
+ expectedReqURL : "https://123456789012.s3-control.us-west-2.amazonaws.com/v20180820/accesspoint /myaccesspoint" ,
329
330
expectedHeaderForAccountID : true ,
330
331
expectedSigningRegion : "us-west-2" ,
331
332
expectedSigningName : "s3" ,
332
333
},
333
334
"outpost access point with unsupported sub-resource" : {
334
- bucket : "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:mybucket:object:foo" ,
335
+ accessPoint : "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:mybucket:object:foo" ,
335
336
options : s3control.Options {
336
337
Region : "us-west-2" ,
337
338
},
338
339
expectedErr : "sub resource not supported" ,
339
340
},
340
341
"Missing outpost identifiers in outpost access point arn" : {
341
- bucket : "arn:aws:s3-outposts:us-west-2:123456789012:accesspoint:myendpoint" ,
342
+ accessPoint : "arn:aws:s3-outposts:us-west-2:123456789012:accesspoint:myendpoint" ,
342
343
options : s3control.Options {
343
344
Region : "us-west-2" ,
344
345
},
@@ -510,19 +511,34 @@ func TestEndpointWithARN(t *testing.T) {
510
511
511
512
ctx := context .Background ()
512
513
513
- // call an operation
514
- _ , err := svc .GetBucket (ctx , & s3control.GetBucketInput {
515
- Bucket : ptr .String (c .bucket ),
516
- AccountId : ptr .String ("123456789012" ),
517
- }, func (options * s3control.Options ) {
518
- // append request retriever middleware for request inspection
519
- options .APIOptions = append (options .APIOptions ,
520
- func (stack * middleware.Stack ) error {
521
- // adds AFTER operation serializer middleware
522
- stack .Serialize .Insert (& fm , "OperationSerializer" , middleware .After )
523
- return nil
524
- })
525
- })
514
+ var err error
515
+ if len (c .accessPoint ) > 0 {
516
+ _ , err = svc .GetAccessPoint (ctx , & s3control.GetAccessPointInput {
517
+ Name : ptr .String (c .accessPoint ),
518
+ AccountId : ptr .String ("123456789012" ),
519
+ }, func (options * s3control.Options ) {
520
+ // append request retriever middleware for request inspection
521
+ options .APIOptions = append (options .APIOptions ,
522
+ func (stack * middleware.Stack ) error {
523
+ // adds AFTER operation serializer middleware
524
+ stack .Serialize .Insert (& fm , "OperationSerializer" , middleware .After )
525
+ return nil
526
+ })
527
+ })
528
+ } else {
529
+ _ , err = svc .GetBucket (ctx , & s3control.GetBucketInput {
530
+ Bucket : ptr .String (c .bucket ),
531
+ AccountId : ptr .String ("123456789012" ),
532
+ }, func (options * s3control.Options ) {
533
+ // append request retriever middleware for request inspection
534
+ options .APIOptions = append (options .APIOptions ,
535
+ func (stack * middleware.Stack ) error {
536
+ // adds AFTER operation serializer middleware
537
+ stack .Serialize .Insert (& fm , "OperationSerializer" , middleware .After )
538
+ return nil
539
+ })
540
+ })
541
+ }
526
542
527
543
// inspect any errors
528
544
if len (c .expectedErr ) != 0 {
0 commit comments