request

package
v1.0.0-beta.68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JWTTigrisClaimSpace = "https://tigris"
	NamespaceCode       = "nc"
	UserEmail           = "ue"
	Subject             = "sub"
)
View Source
const (
	AcceptTypeApplicationJSON = "application/json"
)

Variables

View Source
var ErrNamespaceNotFound = errors.NotFound("namespace not found")

Functions

func GetAccessToken

func GetAccessToken(ctx context.Context) (*types.AccessToken, error)

func GetCurrentSub

func GetCurrentSub(ctx context.Context) (string, error)

func GetMetadataFromHeader

func GetMetadataFromHeader(ctx context.Context) (string, bool, string)

func GetNamespace

func GetNamespace(ctx context.Context) (string, error)

func GetProjectAndBranchAndColl

func GetProjectAndBranchAndColl(req interface{}) (string, string, string)

func Init

func Init(tg metadata.TenantGetter)

func IsAcceptApplicationJSON

func IsAcceptApplicationJSON(ctx context.Context) bool

func IsAdminApi

func IsAdminApi(fullMethodName string) bool

func IsHumanUser

func IsHumanUser(ctx context.Context) bool

func IsRead

func IsRead(ctx context.Context) bool

func IsWrite

func IsWrite(ctx context.Context) bool

func NeedSchemaValidation

func NeedSchemaValidation(ctx context.Context) bool

func ReadSearchDataFromStorage

func ReadSearchDataFromStorage(ctx context.Context) bool

Types

type AccessTokenNamespaceExtractor

type AccessTokenNamespaceExtractor struct{}

func (*AccessTokenNamespaceExtractor) Extract

func (tokenNamespaceExtractor *AccessTokenNamespaceExtractor) Extract(ctx context.Context) (string, error)

type Metadata

type Metadata struct {
	IsHuman bool

	// Current user/application
	Sub string
	// contains filtered or unexported fields
}

func GetGrpcEndPointMetadataFromFullMethod

func GetGrpcEndPointMetadataFromFullMethod(ctx context.Context, fullMethod string, methodType string, req interface{}) Metadata

func GetRequestMetadataFromContext

func GetRequestMetadataFromContext(ctx context.Context) (*Metadata, error)

func NewRequestEndpointMetadata

func NewRequestEndpointMetadata(ctx context.Context, serviceName string, methodInfo grpc.MethodInfo, db string, branch string, coll string) Metadata

func NewRequestMetadata

func NewRequestMetadata(ctx context.Context) Metadata

func (*Metadata) GetBranch

func (m *Metadata) GetBranch() string

func (*Metadata) GetCollection

func (m *Metadata) GetCollection() string

func (*Metadata) GetFullMethod

func (m *Metadata) GetFullMethod() string

func (*Metadata) GetInitialTags

func (m *Metadata) GetInitialTags() map[string]string

func (*Metadata) GetMethodInfo

func (m *Metadata) GetMethodInfo() grpc.MethodInfo

func (*Metadata) GetMethodName

func (m *Metadata) GetMethodName() string

func (*Metadata) GetNamespace

func (m *Metadata) GetNamespace() string

func (*Metadata) GetNamespaceName

func (m *Metadata) GetNamespaceName() string

func (*Metadata) GetProject

func (m *Metadata) GetProject() string

func (*Metadata) GetServiceName

func (m *Metadata) GetServiceName() string

func (*Metadata) GetServiceType

func (m *Metadata) GetServiceType() string

func (*Metadata) GetTigrisNamespaceNameTag

func (m *Metadata) GetTigrisNamespaceNameTag() string

func (*Metadata) SaveToContext

func (m *Metadata) SaveToContext(ctx context.Context) context.Context

func (*Metadata) SetAccessToken

func (m *Metadata) SetAccessToken(token *types.AccessToken)

func (*Metadata) SetBranch

func (m *Metadata) SetBranch(branch string)

func (*Metadata) SetCollection

func (m *Metadata) SetCollection(collection string)

func (*Metadata) SetNamespace

func (m *Metadata) SetNamespace(ctx context.Context, namespace string)

func (*Metadata) SetProject

func (m *Metadata) SetProject(project string)

type MetadataCtxKey

type MetadataCtxKey struct{}

type NamespaceExtractor

type NamespaceExtractor interface {
	Extract(ctx context.Context) (string, error)
}

NamespaceExtractor - extract the namespace from context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL