Documentation ¶
Index ¶
- Constants
- type APIHosts
- type ApplicationContext
- func (appCtx ApplicationContext) ExtendContext(ctx context.Context) context.Context
- func (appCtx ApplicationContext) FillPlaceholders(format string) string
- func (appCtx ApplicationContext) GetApplication() string
- func (appCtx ApplicationContext) GetCommonName() string
- func (appCtx ApplicationContext) GetLogger() *logrus.Entry
- func (appCtx ApplicationContext) GetRuntimeUrls() *RuntimeURLs
- func (appCtx ApplicationContext) IsEmpty() bool
- type ClientContextService
- type ClusterContext
- func (clsCtx ClusterContext) ExtendContext(ctx context.Context) context.Context
- func (clsCtx ClusterContext) FillPlaceholders(format string) string
- func (clsCtx ClusterContext) GetCommonName() string
- func (clsCtx ClusterContext) GetLogger() *logrus.Entry
- func (clsCtx ClusterContext) GetRuntimeUrls() *RuntimeURLs
- func (clsCtx ClusterContext) IsEmpty() bool
- type ConnectorClientExtractor
- type ContextExtender
- type CtxRequiredType
- type ExtendedApplicationContext
- type HeadersRequiredType
- type RuntimeURLs
Constants ¶
const ( MetadataURLFormat = "https://%s/%s/v1/metadata/services" EventsURLFormat = "https://%s/%s/v1/events" )
const ( TenantPlaceholder = "{TENANT}" GroupPlaceholder = "{GROUP}" ApplicationPlaceholder = "{APPLICATION}" // ApplicationHeader is key representing Application in headers ApplicationHeader = "Application" // ApplicationContextKey is the key value for storing Application in context ApplicationContextKey clientContextKey = "ApplicationContext" // SubjectHeader is key representing client certificate subject set in headers SubjectHeader = "Client-Certificate-Subject" // APIHostsKey is the key value for storing API hosts in context APIHostsKey clientContextKey = "APIHosts" // ClusterContextKey is the key value for storing cluster data in context ClusterContextKey clientContextKey = "ClusterContext" // TenantHeader is key representing Tenant in headers TenantHeader = "Tenant" // GroupHeader is key representing Group in headers GroupHeader = "Group" // SubjectCNSeparator holds separator for values packed in CN of Subject SubjectCNSeparator = ";" // GroupEmpty represents empty value for Group GroupEmpty = "" // TenantEmpty represents empty value for Tenant TenantEmpty = "" // ApplicationEmpty represents empty value for Application ApplicationEmpty = "" // CtxRequired represents value for required context CtxRequired CtxRequiredType = true // CtxNotRequired represents value for not required context CtxNotRequired CtxRequiredType = false // HeadersRequired represents value for required headers HeadersRequired HeadersRequiredType = true // HeadersNotRequired represents value for not required headers HeadersNotRequired HeadersRequiredType = false )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationContext ¶
type ApplicationContext struct { Application string `json:"application"` ClusterContext }
func (ApplicationContext) ExtendContext ¶
func (appCtx ApplicationContext) ExtendContext(ctx context.Context) context.Context
ExtendContext extends provided context with ApplicationContext
func (ApplicationContext) FillPlaceholders ¶
func (appCtx ApplicationContext) FillPlaceholders(format string) string
FillPlaceholders replaces placeholders {TENANT}, {GROUP} and {APPLICATION} with values from the context
func (ApplicationContext) GetApplication ¶
func (appCtx ApplicationContext) GetApplication() string
GetApplication returns Application identifier
func (ApplicationContext) GetCommonName ¶
func (appCtx ApplicationContext) GetCommonName() string
GetCommonName returns expected Common Name value for the Application
func (ApplicationContext) GetLogger ¶
func (appCtx ApplicationContext) GetLogger() *logrus.Entry
GetLogger returns context logger with embedded context data (Application, Group and Tenant)
func (ApplicationContext) GetRuntimeUrls ¶
func (appCtx ApplicationContext) GetRuntimeUrls() *RuntimeURLs
GetRuntimeUrls returns nil as ApplicationContext does not contain RuntimeURLs
func (ApplicationContext) IsEmpty ¶
func (appCtx ApplicationContext) IsEmpty() bool
IsEmpty returns false if Application is set
type ClientContextService ¶
type ClientContextService interface { GetCommonName() string GetRuntimeUrls() *RuntimeURLs GetLogger() *logrus.Entry FillPlaceholders(format string) string }
func CreateApplicationClientContextService ¶
func CreateApplicationClientContextService(ctx context.Context) (ClientContextService, apperrors.AppError)
func CreateClusterClientContextService ¶
func CreateClusterClientContextService(ctx context.Context) (ClientContextService, apperrors.AppError)
type ClusterContext ¶
type ClusterContext struct { Group string `json:"group,omitempty"` Tenant string `json:"tenant,omitempty"` }
func (ClusterContext) ExtendContext ¶
func (clsCtx ClusterContext) ExtendContext(ctx context.Context) context.Context
ExtendContext extends provided context with ClusterContext
func (ClusterContext) FillPlaceholders ¶
func (clsCtx ClusterContext) FillPlaceholders(format string) string
FillPlaceholders replaces placeholders {TENANT}, {GROUP} with values from the context
func (ClusterContext) GetCommonName ¶
func (clsCtx ClusterContext) GetCommonName() string
GetCommonName returns expected Common Name value for the Cluster
func (ClusterContext) GetLogger ¶
func (clsCtx ClusterContext) GetLogger() *logrus.Entry
GetLogger returns context logger with embedded context data (Group and Tenant)
func (ClusterContext) GetRuntimeUrls ¶
func (clsCtx ClusterContext) GetRuntimeUrls() *RuntimeURLs
GetRuntimeUrls returns nil as ClusterContext does not contain RuntimeURLs
func (ClusterContext) IsEmpty ¶
func (clsCtx ClusterContext) IsEmpty() bool
IsEmpty returns false if both Group and Tenant are set
type ConnectorClientExtractor ¶
type ConnectorClientExtractor func(ctx context.Context) (ClientContextService, apperrors.AppError)
type ContextExtender ¶
func NewApplicationContextExtender ¶
func NewApplicationContextExtender() ContextExtender
NewApplicationContextExtender returns empty ApplicationContext
func NewClusterContextExtender ¶
func NewClusterContextExtender() ContextExtender
NewClusterContextExtender creates empty ClusterContext
type CtxRequiredType ¶
type CtxRequiredType bool
CtxRequiredType type defines if context is mandatory
type ExtendedApplicationContext ¶
type ExtendedApplicationContext struct { ApplicationContext RuntimeURLs }
func (ExtendedApplicationContext) GetRuntimeUrls ¶
func (extAppCtx ExtendedApplicationContext) GetRuntimeUrls() *RuntimeURLs
GetRuntimeUrls returns pointer to RuntimeURLs
func (ExtendedApplicationContext) MarshalJSON ¶
func (extAppCtx ExtendedApplicationContext) MarshalJSON() ([]byte, error)
MarshalJSON marshals ExtendedApplicationContext to JSON as ApplicationContext
type HeadersRequiredType ¶
type HeadersRequiredType bool
HeadersRequiredType type defines if headers must be specified