1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
package customizations
import (
"context"
"github.com/aws/smithy-go/middleware"
)
type bucketKey struct{}
// SetBucket stores a bucket name within the request context, which is required
// for a variety of custom S3 behaviors.
func SetBucket(ctx context.Context, bucket string) context.Context {
return middleware.WithStackValue(ctx, bucketKey{}, bucket)
}
// GetBucket retrieves a stored bucket name within a context.
func GetBucket(ctx context.Context) string {
v, _ := middleware.GetStackValue(ctx, bucketKey{}).(string)
return v
}
|