Skip to content

Commit

Permalink
s3 customization feedback changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skotambkar committed Nov 13, 2020
1 parent 8553c94 commit add13c6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions service/s3/internal/customizations/update_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ type UpdateEndpointParameterAccessor struct {
// input has no bucket member.
GetBucketFromInput func(interface{}) (*string, bool)

// functional pointer to indicate support for accelerate.
// The function is intended to take an input value, and
// return if the operation supports accelerate.
SupportsAccelerate func(interface{}) bool
// indicates if an operation supports s3 transfer acceleration.
SupportsAccelerate bool
}

// UpdateEndpointOptions provides the options for the UpdateEndpoint middleware setup.
Expand Down Expand Up @@ -67,9 +65,9 @@ type UpdateEndpointOptions struct {
// UpdateEndpoint adds the middleware to the middleware stack based on the UpdateEndpointOptions.
func UpdateEndpoint(stack *middleware.Stack, options UpdateEndpointOptions) (err error) {
// initial arn look up middleware
err = stack.Initialize.Insert(&s3shared.ARNLookup{
err = stack.Initialize.Add(&s3shared.ARNLookup{
GetARNValue: options.Accessor.GetBucketFromInput,
}, "OperationInputValidation", middleware.Before)
}, middleware.Before)
if err != nil {
return err
}
Expand Down Expand Up @@ -122,7 +120,7 @@ type updateEndpoint struct {

// accelerate options
useAccelerate bool
supportsAccelerate func(interface{}) bool
supportsAccelerate bool
}

// ID returns the middleware ID.
Expand Down Expand Up @@ -151,7 +149,7 @@ func (u *updateEndpoint) HandleSerialize(
}

// check if accelerate is supported
if u.supportsAccelerate == nil || (u.useAccelerate && !u.supportsAccelerate(in.Parameters)) {
if u.useAccelerate && !u.supportsAccelerate {
// accelerate is not supported, thus will be ignored
log.Println("Transfer acceleration is not supported for the operation, ignoring UseAccelerate.")
u.useAccelerate = false
Expand Down

0 comments on commit add13c6

Please sign in to comment.