request

package
v1.0.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func GetMetadataFromHeader

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

func GetNamespace

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

func Init

func Init(tg metadata.TenantGetter)

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

Types

type AccessToken

type AccessToken struct {
	Namespace string
	Sub       string
}

func GetAccessToken

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

type AccessTokenNamespaceExtractor

type AccessTokenNamespaceExtractor struct{}

func (*AccessTokenNamespaceExtractor) Extract

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

type Metadata

type Metadata struct {
	IsHuman bool
	// contains filtered or unexported fields
}

func GetGrpcEndPointMetadataFromFullMethod

func GetGrpcEndPointMetadataFromFullMethod(ctx context.Context, fullMethod string, methodType string) Metadata

func GetRequestMetadataFromContext

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

func NewRequestEndpointMetadata

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

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) 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 *AccessToken)

func (*Metadata) SetNamespace

func (m *Metadata) SetNamespace(ctx context.Context, namespace 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