metadata.go 891 B

12345678910111213141516171819202122232425262728
  1. package s3shared
  2. import (
  3. "context"
  4. "github.com/aws/smithy-go/middleware"
  5. )
  6. // clonedInputKey used to denote if request input was cloned.
  7. type clonedInputKey struct{}
  8. // SetClonedInputKey sets a key on context to denote input was cloned previously.
  9. //
  10. // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues
  11. // to clear all stack values.
  12. func SetClonedInputKey(ctx context.Context, value bool) context.Context {
  13. return middleware.WithStackValue(ctx, clonedInputKey{}, value)
  14. }
  15. // IsClonedInput retrieves if context key for cloned input was set.
  16. // If set, we can infer that the reuqest input was cloned previously.
  17. //
  18. // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues
  19. // to clear all stack values.
  20. func IsClonedInput(ctx context.Context) bool {
  21. v, _ := middleware.GetStackValue(ctx, clonedInputKey{}).(bool)
  22. return v
  23. }