...

Source file src/github.com/aws/aws-sdk-go-v2/internal/context/context.go

Documentation: github.com/aws/aws-sdk-go-v2/internal/context

     1  package context
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/aws/smithy-go/middleware"
     7  )
     8  
     9  type s3BackendKey struct{}
    10  type checksumInputAlgorithmKey struct{}
    11  
    12  const (
    13  	// S3BackendS3Express identifies the S3Express backend
    14  	S3BackendS3Express = "S3Express"
    15  )
    16  
    17  // SetS3Backend stores the resolved endpoint backend within the request
    18  // context, which is required for a variety of custom S3 behaviors.
    19  func SetS3Backend(ctx context.Context, typ string) context.Context {
    20  	return middleware.WithStackValue(ctx, s3BackendKey{}, typ)
    21  }
    22  
    23  // GetS3Backend retrieves the stored endpoint backend within the context.
    24  func GetS3Backend(ctx context.Context) string {
    25  	v, _ := middleware.GetStackValue(ctx, s3BackendKey{}).(string)
    26  	return v
    27  }
    28  
    29  // SetChecksumInputAlgorithm sets the request checksum algorithm on the
    30  // context.
    31  func SetChecksumInputAlgorithm(ctx context.Context, value string) context.Context {
    32  	return middleware.WithStackValue(ctx, checksumInputAlgorithmKey{}, value)
    33  }
    34  
    35  // GetChecksumInputAlgorithm returns the checksum algorithm from the context.
    36  func GetChecksumInputAlgorithm(ctx context.Context) string {
    37  	v, _ := middleware.GetStackValue(ctx, checksumInputAlgorithmKey{}).(string)
    38  	return v
    39  }
    40  

View as plain text