Documentation ¶
Overview ¶
Package callerid stores/retrives CallerIDs (immediate CallerID and effective CallerID) to/from the Context
Index ¶
- Constants
- func EffectiveCallerIDFromContext(ctx context.Context) *vtpb.CallerID
- func GetComponent(ef *vtpb.CallerID) string
- func GetPrincipal(ef *vtpb.CallerID) string
- func GetSubcomponent(ef *vtpb.CallerID) string
- func GetUsername(im *qrpb.VTGateCallerID) string
- func GoRPCEffectiveCallerID(c *proto.CallerID) *vtpb.CallerID
- func GoRPCImmediateCallerID(v *proto.VTGateCallerID) *qrpb.VTGateCallerID
- func ImmediateCallerIDFromContext(ctx context.Context) *qrpb.VTGateCallerID
- func NewContext(ctx context.Context, ef *vtpb.CallerID, im *qrpb.VTGateCallerID) context.Context
- func NewEffectiveCallerID(principal string, component string, subComponent string) *vtpb.CallerID
- func NewImmediateCallerID(username string) *qrpb.VTGateCallerID
- func Tests(t *testing.T, im *qrpb.VTGateCallerID, ef *vtpb.CallerID)
Constants ¶
const ( // FakePrincipal is the principal of testing effective CallerID FakePrincipal = "TestPrincipal" // FakeComponent is the component of testing effective CallerID FakeComponent = "TestComponent" // FakeSubcomponent is the subcomponent of testing effective CallerID FakeSubcomponent = "TestSubcomponent" // FakeUsername is the username of testing immediate CallerID FakeUsername = "TestUsername" )
Variables ¶
This section is empty.
Functions ¶
func EffectiveCallerIDFromContext ¶
EffectiveCallerIDFromContext returns the EffectiveCallerID(vtpb.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 inisde 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 *qrpb.VTGateCallerID) string
GetUsername returns the immediate caller of VTGate
func GoRPCEffectiveCallerID ¶
GoRPCEffectiveCallerID creates new EffectiveCallerID(vtpb.CallerID) from GoRPC's CallerID
func GoRPCImmediateCallerID ¶
func GoRPCImmediateCallerID(v *proto.VTGateCallerID) *qrpb.VTGateCallerID
GoRPCImmediateCallerID creates new ImmediateCallerID(qrpb.VTGateCallerID) from GoRPC's VTGateCallerID
func ImmediateCallerIDFromContext ¶
func ImmediateCallerIDFromContext(ctx context.Context) *qrpb.VTGateCallerID
ImmediateCallerIDFromContext returns the ImmediateCallerID(qrpb.VTGateCallerID) stored in the Context, if any
func NewContext ¶
NewContext adds the provided EffectiveCallerID(vtpb.CallerID) and ImmediateCallerID(qrpb.VTGateCallerID) into the Context
func NewEffectiveCallerID ¶
NewEffectiveCallerID creates a new vtpb.CallerID with principal, component and subComponent
func NewImmediateCallerID ¶
func NewImmediateCallerID(username string) *qrpb.VTGateCallerID
NewImmediateCallerID creates a qrpb.VTGateCallerID initialized with username
Types ¶
This section is empty.