src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

middleware_metadata.go (1605B)


      1 package http
      2 
      3 import (
      4 	"context"
      5 
      6 	"github.com/aws/smithy-go/middleware"
      7 )
      8 
      9 type (
     10 	hostnameImmutableKey struct{}
     11 	hostPrefixDisableKey struct{}
     12 )
     13 
     14 // GetHostnameImmutable retrieves whether the endpoint hostname should be considered
     15 // immutable or not.
     16 //
     17 // Scoped to stack values. Use middleware#ClearStackValues to clear all stack
     18 // values.
     19 func GetHostnameImmutable(ctx context.Context) (v bool) {
     20 	v, _ = middleware.GetStackValue(ctx, hostnameImmutableKey{}).(bool)
     21 	return v
     22 }
     23 
     24 // SetHostnameImmutable sets or modifies whether the request's endpoint hostname
     25 // should be considered immutable or not.
     26 //
     27 // Scoped to stack values. Use middleware#ClearStackValues to clear all stack
     28 // values.
     29 func SetHostnameImmutable(ctx context.Context, value bool) context.Context {
     30 	return middleware.WithStackValue(ctx, hostnameImmutableKey{}, value)
     31 }
     32 
     33 // IsEndpointHostPrefixDisabled retrieves whether the hostname prefixing is
     34 // disabled.
     35 //
     36 // Scoped to stack values. Use middleware#ClearStackValues to clear all stack
     37 // values.
     38 func IsEndpointHostPrefixDisabled(ctx context.Context) (v bool) {
     39 	v, _ = middleware.GetStackValue(ctx, hostPrefixDisableKey{}).(bool)
     40 	return v
     41 }
     42 
     43 // DisableEndpointHostPrefix sets or modifies whether the request's endpoint host
     44 // prefixing should be disabled. If value is true, endpoint host prefixing
     45 // will be disabled.
     46 //
     47 // Scoped to stack values. Use middleware#ClearStackValues to clear all stack
     48 // values.
     49 func DisableEndpointHostPrefix(ctx context.Context, value bool) context.Context {
     50 	return middleware.WithStackValue(ctx, hostPrefixDisableKey{}, value)
     51 }