Documentation ¶
Overview ¶
Package callerid stores/retrieves CallerIDs (immediate CallerID and effective CallerID) to/from the Context
Index ¶
- func EffectiveCallerIDFromContext(ctx context.Context) *vtrpcpb.CallerID
- func GetComponent(ef *vtrpcpb.CallerID) string
- func GetPrincipal(ef *vtrpcpb.CallerID) string
- func GetSubcomponent(ef *vtrpcpb.CallerID) string
- func GetUsername(im *querypb.VTGateCallerID) string
- func ImmediateCallerIDFromContext(ctx context.Context) *querypb.VTGateCallerID
- func NewContext(ctx context.Context, ef *vtrpcpb.CallerID, im *querypb.VTGateCallerID) context.Context
- func NewEffectiveCallerID(principal string, component string, subComponent string) *vtrpcpb.CallerID
- func NewImmediateCallerID(username string) *querypb.VTGateCallerID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EffectiveCallerIDFromContext ¶
EffectiveCallerIDFromContext returns the EffectiveCallerID(vtrpcpb.CallerID) stored in the Context, if any
func GetComponent ¶
GetComponent returns the running process of the effective caller. It can for instance return hostname:port of the servlet initiating the database call, or the container engine ID used by the servlet.
func GetPrincipal ¶
GetPrincipal returns the effective user identifier, which is usually filled in with whoever made the request to the appserver, if the request came from an automated job or another system component. If the request comes directly from the Internet, or if the Vitess client takes action on its own accord, it is okay for this method to return empty string.
func GetSubcomponent ¶
GetSubcomponent returns a component inside the process of effective caller, which is responsible for generating this request. Suggested values are a servlet name or an API endpoint name.
func GetUsername ¶
func GetUsername(im *querypb.VTGateCallerID) string
GetUsername returns the immediate caller of VTGate
func ImmediateCallerIDFromContext ¶
func ImmediateCallerIDFromContext(ctx context.Context) *querypb.VTGateCallerID
ImmediateCallerIDFromContext returns the ImmediateCallerID(querypb.VTGateCallerID) stored in the Context, if any
func NewContext ¶
func NewContext(ctx context.Context, ef *vtrpcpb.CallerID, im *querypb.VTGateCallerID) context.Context
NewContext adds the provided EffectiveCallerID(vtrpcpb.CallerID) and ImmediateCallerID(querypb.VTGateCallerID) into the Context
func NewEffectiveCallerID ¶
func NewEffectiveCallerID(principal string, component string, subComponent string) *vtrpcpb.CallerID
NewEffectiveCallerID creates a new vtrpcpb.CallerID with principal, component and subComponent
func NewImmediateCallerID ¶
func NewImmediateCallerID(username string) *querypb.VTGateCallerID
NewImmediateCallerID creates a querypb.VTGateCallerID initialized with username
Types ¶
This section is empty.