Documentation ¶
Index ¶
- Constants
- Variables
- func IsPlatformEvent(evt DataEvent) bool
- func NewHTTPClient() *http.Client
- type ComponentSvc
- type ContextKey
- type CustomizeResponse
- type DataEvent
- type Entrypoint
- type EntrypointMatcher
- type Event
- type EventMatcher
- type HTTPDataEvent
- type HTTPEvent
- type Hook
- type Kit
- type KitBroker
- type KitRoundTripper
- type KitSvc
- type KubeDataEvent
- type KubeEvent
- type KubeResponse
- type ObjectStub
- type RelatedResourceRule
- type RequestStub
Constants ¶
View Source
const ( ConfigurationErrorCode = 10 JetStreamErrorCode = 11 RpcServerErrorCode = 12 HTTPServerErrorCode = 13 TelemetryServerErrorCode = 14 InterruptCode = 130 )
OS status codes
View Source
const ( ComponentRequestType = "io.kubefox.component_request" ComponentResponseType = "io.kubefox.component_response" CronRequestType = "io.kubefox.cron_request" CronResponseType = "io.kubefox.cron_response" DaprRequestType = "io.kubefox.dapr_request" DaprResponseType = "io.kubefox.dapr_response" HTTPRequestType = "io.kubefox.http_request" HTTPResponseType = "io.kubefox.http_response" KubernetesRequestType = "io.kubefox.kubernetes_request" KubernetesResponseType = "io.kubefox.kubernetes_response" )
Component event types
View Source
const ( BootstrapRequestType = "io.kubefox.bootstrap_request" BootstrapResponseType = "io.kubefox.bootstrap_response" FabricRequestType = "io.kubefox.fabric_request" FabricResponseType = "io.kubefox.fabric_response" )
Platform event types
Update `IsPlatformEvent()` in event.go if changes are made.
View Source
const ( HealthRequestType = "io.kubefox.health_request" HealthResponseType = "io.kubefox.health_response" MetricsRequestType = "io.kubefox.metrics_request" MetricsResponseType = "io.kubefox.metrics_response" TelemetryRequestType = "io.kubefox.telemetry_request" TelemetryResponseType = "io.kubefox.telemetry_response" ErrorEventType = "io.kubefox.error" RejectedEventType = "io.kubefox.rejected" UnknownEventType = "io.kubefox.unknown" )
Internal event types
View Source
const ( EnvHeader = "kf-environment" EnvHeaderShort = "kf-env" SysHeader = "kf-system" SysHeaderShort = "kf-sys" TargetHeader = "kf-target" EventTypeHeader = "kf-event-type" RelEnvHeader = "kf-release-environment" RelSysHeader = "kf-release-system" RelTargetHeader = "kf-release-target" RelEventTypeHeader = "kf-release-event-type" )
KubeFox headers/query params
Variables ¶
View Source
var ( ErrChannelNotFound = errors.New("a channel with that id was not found") ErrComponentNameNotFound = errors.New("component name not found, environment variable `UNIT_NAME` should be set") ErrDuplicateChannel = errors.New("a channel with that id already exists") ErrEntrypointNotFound = errors.New("a matching entrypoint was not found") ErrInvalidEnvironment = errors.New("invalid environment") ErrInvalidSystem = errors.New("invalid environment") ErrInvalidTarget = errors.New("provided KubeFox target component is invalid") ErrMissingEnvironment = errors.New("request is missing KubeFox Environment") ErrMissingId = errors.New("id is missing") ErrMissingMetadata = errors.New("request is missing metadata") ErrMissingRequestId = errors.New("request id is missing") ErrMissingRequestor = errors.New("requestor is missing") ErrMissingResponder = errors.New("responder is missing") ErrMissingSystem = errors.New("request is missing KubeFox System") ErrMissingSysRef = errors.New("request is missing KubeFox SysRef") ErrMissingTarget = errors.New("request is missing KubeFox target Component") ErrNotFound = errors.New("not found") ErrSubscriptionClosed = errors.New("subscription closed, unable to fetch") ErrSubscriptionExists = errors.New("a component as already subscribed") ErrSubscriptionNotFound = errors.New("a subscription with that id was not found") ErrTypeMismatch = errors.New("event type mismatch") ErrUnsupportedRequest = errors.New("request type is not supported") )
Functions ¶
func IsPlatformEvent ¶
func NewHTTPClient ¶
Types ¶
type ComponentSvc ¶
type ComponentSvc struct {
// contains filtered or unexported fields
}
type ContextKey ¶
type ContextKey string
const (
KitContextKey ContextKey = "KitContext"
)
const (
LogContextKey ContextKey = "LogContext"
)
type CustomizeResponse ¶
type CustomizeResponse struct {
RelatedResourceRules []*RelatedResourceRule `json:"relatedResources,omitempty"`
}
type DataEvent ¶
type DataEvent interface { Event GetData() *grpc.Data ChildEvent() DataEvent ChildErrorEvent(error) DataEvent SetParent(Event) SetParentId(string) SetSource(component.Component, string) SetTarget(component.Component) SetContext(*grpc.EventContext) GetFabric() *grpc.Fabric SetFabric(*grpc.Fabric) SetSpan(*grpc.Span) UpdateSpan(trace.Span) SetToken(jwt.Token) SetValue(string, string) SetValueNumber(string, float64) HTTPData() HTTPDataEvent KubeData() KubeDataEvent SetError(error) GetError() error GetErrorMsg() string }
func EmptyDataEvent ¶
func EmptyDataEvent() DataEvent
func EventFromData ¶
func NewDataEvent ¶
func NewErrorEvent ¶
type Entrypoint ¶
type EntrypointMatcher ¶
type EntrypointMatcher struct {
// contains filtered or unexported fields
}
func (*EntrypointMatcher) Match ¶
func (m *EntrypointMatcher) Match(evt DataEvent) bool
func (*EntrypointMatcher) Rule ¶
func (m *EntrypointMatcher) Rule() string
type Event ¶
type Event interface { GetId() string GetParentId() string GetType() string SetType(string) GetToken() *grpc.Token GetSpan() *grpc.Span GetTraceId() string GetSource() component.Component GetTarget() component.Component GetContext() *grpc.EventContext GetArg(string) string GetArgVar(string) *common.Var SetArg(string, string) SetArgNumber(string, float64) GetValue(string) string GetValueVar(string) *common.Var GetContentType() string SetContentType(string) GetContent() []byte SetContent([]byte) Marshal(any) error Unmarshal(any) error UnmarshalStrict(any) error HTTP() HTTPEvent Kube() KubeEvent }
TODO create interfaces for grpc stuff
type EventMatcher ¶
type EventMatcher struct {
// contains filtered or unexported fields
}
func NewEventMatcher ¶
func NewEventMatcher(rule string) (*EventMatcher, error)
func (*EventMatcher) Match ¶
func (m *EventMatcher) Match(e Event) bool
func (*EventMatcher) Rule ¶
func (m *EventMatcher) Rule() string
type HTTPDataEvent ¶
type HTTPEvent ¶
type HTTPEvent interface { Event GetURL() *url.URL GetURLString() string GetPath() string GetStatus() string SetStatus(v string) GetStatusCode() int SetStatusCode(v int) GetMethod() string SetMethod(method string) GetHeaderKeys() []string GetHeader(string) string GetHeaderValues(string) []string AddHeader(string, string) SetHeader(string, string) GetHTTPHeader() http.Header SetHTTPHeader(http.Header) }
type KitRoundTripper ¶
type KitRoundTripper struct{}
type KitSvc ¶
type KitSvc interface { Start() Http(string, Entrypoint) Kubernetes(string, Entrypoint) MatchEvent(string, Entrypoint) DefaultEntrypoint(Entrypoint) // Organization() string Platform() string Namespace() string DevMode() bool Fatal(err error) Log() *logger.Log }
type KubeDataEvent ¶
type KubeResponse ¶
type ObjectStub ¶
type ObjectStub struct {
Kind string `json:"kind"`
}
type RelatedResourceRule ¶
type RequestStub ¶
type RequestStub struct { Object *ObjectStub `json:"object"` // for sync requests Parent *ObjectStub `json:"parent"` // for customize requests }
Click to show internal directories.
Click to hide internal directories.