MCPcopy Create free account
hub / github.com/aws/smithy-go / WithStackValue

Function WithStackValue

middleware/stack_values.go:12–17  ·  view source on GitHub ↗

WithStackValue adds a key value pair to the context that is intended to be scoped to a stack. Use ClearStackValues to get a new context with all stack values cleared.

(ctx context.Context, key, value interface{})

Source from the content-addressed store, hash-verified

10// scoped to a stack. Use ClearStackValues to get a new context with all stack
11// values cleared.
12func WithStackValue(ctx context.Context, key, value interface{}) context.Context {
13 md, _ := ctx.Value(stackValuesKey{}).(*stackValues)
14
15 md = withStackValue(md, key, value)
16 return context.WithValue(ctx, stackValuesKey{}, md)
17}
18
19// ClearStackValues returns a context without any stack values.
20func ClearStackValues(ctx context.Context) context.Context {

Callers 6

SetHostnameImmutableFunction · 0.92
withIctxFunction · 0.92
TestStackValuesFunction · 0.85
WithServiceIDFunction · 0.85
WithOperationNameFunction · 0.85

Calls 2

withStackValueFunction · 0.85
ValueMethod · 0.45

Tested by 1

TestStackValuesFunction · 0.68