mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-08-23 22:26:49 +00:00
Post / coverage (push) Failing after 26m56s
Post / images (amd64) (push) Failing after 6m52s
Post / images (arm64) (push) Failing after 6m50s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 54s
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1m19s
* Acceping AWS IRSA registraion request Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Addressing comments Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Addressing comments Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Making csr as a default enabled driver if no other driver is explicitly enabled Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> --------- Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> Co-authored-by: “Jeffrey <jeffreywong0417@gmail.com> Co-authored-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com>
42 lines
1.4 KiB
Go
42 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
|
|
}
|