kinesis-consumer/vendor/github.com/aws/smithy-go/middleware/context.go
dependabot[bot] 1e1696ae0f
Bump github.com/aws/aws-sdk-go-v2/config from 1.27.35 to 1.27.39
Bumps [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) from 1.27.35 to 1.27.39.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.27.35...config/v1.27.39)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 13:17:24 +00:00

41 lines
1.4 KiB
Go

package middleware
import "context"
type (
serviceIDKey struct{}
operationNameKey struct{}
)
// WithServiceID adds a service ID to the context, scoped to middleware stack
// values.
//
// This API is called in the client runtime when bootstrapping an operation and
// should not typically be used directly.
func WithServiceID(parent context.Context, id string) context.Context {
return WithStackValue(parent, serviceIDKey{}, id)
}
// GetServiceID retrieves the service ID from the context. This is typically
// the service shape's name from its Smithy model. Service clients for specific
// systems (e.g. AWS SDK) may use an alternate designated value.
func GetServiceID(ctx context.Context) string {
id, _ := GetStackValue(ctx, serviceIDKey{}).(string)
return id
}
// WithOperationName adds the operation name to the context, scoped to
// middleware stack values.
//
// This API is called in the client runtime when bootstrapping an operation and
// should not typically be used directly.
func WithOperationName(parent context.Context, id string) context.Context {
return WithStackValue(parent, operationNameKey{}, id)
}
// GetOperationName retrieves the operation name from the context. This is
// typically the operation shape's name from its Smithy model.
func GetOperationName(ctx context.Context) string {
name, _ := GetStackValue(ctx, operationNameKey{}).(string)
return name
}