Files
Ryan McKinley 1a46039037 K8s/Dashboards: Pass the legacy internal ID into labels (#98311)
---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
2024-12-20 21:33:49 +02:00

22 lines
426 B
Go

package legacy
import (
"context"
)
type LegacyValue struct {
DashboardID int64
}
type accessKey struct{}
// WithRequester attaches the requester to the context.
func WithLegacyAccess(ctx context.Context) context.Context {
return context.WithValue(ctx, accessKey{}, &LegacyValue{})
}
func GetLegacyAccess(ctx context.Context) *LegacyValue {
v, _ := ctx.Value(accessKey{}).(*LegacyValue)
return v // nil if missing
}