Documentation ¶
Index ¶
- type DefaultLogger
- func (d DefaultLogger) Debug(v ...interface{})
- func (d DefaultLogger) Debugf(format string, v ...interface{})
- func (d DefaultLogger) Error(v ...interface{})
- func (d DefaultLogger) Errorf(format string, v ...interface{})
- func (d DefaultLogger) Fatal(v ...interface{})
- func (d DefaultLogger) Fatalf(format string, v ...interface{})
- func (d DefaultLogger) Info(v ...interface{})
- func (d DefaultLogger) Infof(format string, v ...interface{})
- func (d DefaultLogger) Warn(v ...interface{})
- func (d DefaultLogger) Warnf(format string, v ...interface{})
- type Error
- type FailingResourceHandler
- type FakeKeptn
- func (f *FakeKeptn) AddTaskHandler(eventType string, handler TaskHandler, ...)
- func (f *FakeKeptn) AddTaskHandlerWithSubscriptionID(eventType string, handler TaskHandler, subscriptionID string, ...)
- func (f *FakeKeptn) AssertNumberOfEventSent(t *testing.T, numOfEvents int)
- func (f *FakeKeptn) AssertSentEvent(t *testing.T, eventIndex int, ...)
- func (f *FakeKeptn) AssertSentEventResult(t *testing.T, eventIndex int, result v0_2_0.ResultType)
- func (f *FakeKeptn) AssertSentEventStatus(t *testing.T, eventIndex int, status v0_2_0.StatusType)
- func (f *FakeKeptn) AssertSentEventType(t *testing.T, eventIndex int, eventType string)
- func (f *FakeKeptn) GetResourceHandler() ResourceHandler
- func (f *FakeKeptn) NewEvent(event models.KeptnContextExtendedCE) error
- func (f *FakeKeptn) SetAPI(api api.KeptnInterface)
- func (f *FakeKeptn) SetAutomaticResponse(autoResponse bool)
- func (f *FakeKeptn) SetResourceHandler(handler ResourceHandler)
- type IKeptn
- type Keptn
- func (k *Keptn) APIV1() api.KeptnInterface
- func (k *Keptn) GetResourceHandler() ResourceHandler
- func (k *Keptn) Logger() Logger
- func (k *Keptn) OnEvent(ctx context.Context, event models.KeptnContextExtendedCE) error
- func (k *Keptn) RegistrationData() controlplane.RegistrationData
- func (k *Keptn) SendFinishedEvent(event KeptnEvent, result interface{}) error
- func (k *Keptn) SendStartedEvent(event KeptnEvent) error
- func (k *Keptn) Start() error
- type KeptnEvent
- type KeptnOption
- type Logger
- type ResourceHandler
- type StringResourceHandler
- type TaskHandler
- type TestResourceHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
DefaultLogger implementation of Logger using the go log package
func (DefaultLogger) Debug ¶
func (d DefaultLogger) Debug(v ...interface{})
func (DefaultLogger) Debugf ¶
func (d DefaultLogger) Debugf(format string, v ...interface{})
func (DefaultLogger) Error ¶
func (d DefaultLogger) Error(v ...interface{})
func (DefaultLogger) Errorf ¶
func (d DefaultLogger) Errorf(format string, v ...interface{})
func (DefaultLogger) Fatal ¶
func (d DefaultLogger) Fatal(v ...interface{})
func (DefaultLogger) Fatalf ¶
func (d DefaultLogger) Fatalf(format string, v ...interface{})
func (DefaultLogger) Info ¶
func (d DefaultLogger) Info(v ...interface{})
func (DefaultLogger) Infof ¶
func (d DefaultLogger) Infof(format string, v ...interface{})
func (DefaultLogger) Warn ¶
func (d DefaultLogger) Warn(v ...interface{})
func (DefaultLogger) Warnf ¶
func (d DefaultLogger) Warnf(format string, v ...interface{})
type Error ¶
type Error struct { StatusType keptnv2.StatusType ResultType keptnv2.ResultType Message string Err error }
type FailingResourceHandler ¶
type FailingResourceHandler struct { }
func (FailingResourceHandler) GetResource ¶
func (f FailingResourceHandler) GetResource(scope api.ResourceScope, options ...api.URIOption) (*models.Resource, error)
type FakeKeptn ¶
type FakeKeptn struct { TestResourceHandler ResourceHandler SentEvents []models.KeptnContextExtendedCE Keptn *Keptn }
func NewFakeKeptn ¶
func (*FakeKeptn) AddTaskHandler ¶
func (f *FakeKeptn) AddTaskHandler(eventType string, handler TaskHandler, filters ...func(keptnHandle IKeptn, event KeptnEvent) bool)
func (*FakeKeptn) AddTaskHandlerWithSubscriptionID ¶
func (f *FakeKeptn) AddTaskHandlerWithSubscriptionID(eventType string, handler TaskHandler, subscriptionID string, filters ...func(keptnHandle IKeptn, event KeptnEvent) bool)
func (*FakeKeptn) AssertNumberOfEventSent ¶
func (*FakeKeptn) AssertSentEvent ¶
func (*FakeKeptn) AssertSentEventResult ¶
func (*FakeKeptn) AssertSentEventStatus ¶
func (*FakeKeptn) AssertSentEventType ¶
func (*FakeKeptn) GetResourceHandler ¶
func (f *FakeKeptn) GetResourceHandler() ResourceHandler
func (*FakeKeptn) NewEvent ¶
func (f *FakeKeptn) NewEvent(event models.KeptnContextExtendedCE) error
func (*FakeKeptn) SetAPI ¶
func (f *FakeKeptn) SetAPI(api api.KeptnInterface)
func (*FakeKeptn) SetAutomaticResponse ¶
func (*FakeKeptn) SetResourceHandler ¶
func (f *FakeKeptn) SetResourceHandler(handler ResourceHandler)
type IKeptn ¶
type IKeptn interface { // Start starts the internal event handling logic and needs to be called by the user // after creating value of IKeptn Start() error // GetResourceHandler returns a handler to fetch data from the configuration service GetResourceHandler() ResourceHandler // SendStartedEvent sends a started event for the given input event to the Keptn API SendStartedEvent(event KeptnEvent) error // SendFinishedEvent sends a finished event for the given input event to the Keptn API SendFinishedEvent(event KeptnEvent, result interface{}) error // Logger returns the logger used by the sdk // Per default DefaultLogger is used which internally just uses the go logging package // Another logger can be configured using the sdk.WithLogger function Logger() Logger // APIV1 returns API utils for all Keptn APIs APIV1() api.KeptnInterface }
type Keptn ¶
type Keptn struct {
// contains filtered or unexported fields
}
Keptn is the default implementation of IKeptn
func NewKeptn ¶
func NewKeptn(source string, opts ...KeptnOption) *Keptn
NewKeptn creates a new Keptn
func (*Keptn) APIV1 ¶
func (k *Keptn) APIV1() api.KeptnInterface
func (*Keptn) GetResourceHandler ¶
func (k *Keptn) GetResourceHandler() ResourceHandler
func (*Keptn) RegistrationData ¶
func (k *Keptn) RegistrationData() controlplane.RegistrationData
func (*Keptn) SendFinishedEvent ¶
func (k *Keptn) SendFinishedEvent(event KeptnEvent, result interface{}) error
func (*Keptn) SendStartedEvent ¶
func (k *Keptn) SendStartedEvent(event KeptnEvent) error
type KeptnEvent ¶
type KeptnEvent models.KeptnContextExtendedCE
type KeptnOption ¶
type KeptnOption func(*Keptn)
KeptnOption can be used to configure the keptn sdk
func WithAutomaticResponse ¶
func WithAutomaticResponse(autoResponse bool) KeptnOption
WithAutomaticResponse sets the option to instruct the sdk to automatically send a .started and .finished event. Per default this behavior is turned on and can be disabled with this function
func WithGracefulShutdown ¶
func WithGracefulShutdown(gracefulShutdown bool) KeptnOption
WithGracefulShutdown sets the option to ensure running tasks/handlers will finish in case of interrupt or forced termination Per default this behavior is turned on and can be disabled with this function
func WithLogger ¶
func WithLogger(logger Logger) KeptnOption
WithLogger configures keptn to use another logger
func WithTaskHandler ¶
func WithTaskHandler(eventType string, handler TaskHandler, filters ...func(keptnHandle IKeptn, event KeptnEvent) bool) KeptnOption
WithTaskHandler registers a handler which is responsible for processing a .triggered event
type Logger ¶
type Logger interface { Debug(v ...interface{}) Debugf(format string, v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) }
Logger interface used by the go sdk
type ResourceHandler ¶
type StringResourceHandler ¶
type StringResourceHandler struct {
ResourceContent string
}
func (StringResourceHandler) GetResource ¶
func (s StringResourceHandler) GetResource(scope api.ResourceScope, options ...api.URIOption) (*models.Resource, error)
type TaskHandler ¶
type TaskHandler interface { // Execute is called whenever the actual business-logic of the service shall be executed. // Thus, the core logic of the service shall be triggered/implemented in this method. // // Note, that the contract of the method is to return the payload of the .finished event to be sent out as well as a Error Pointer // or nil, if there was no error during execution. Execute(keptnHandle IKeptn, event KeptnEvent) (interface{}, *Error) }
type TestResourceHandler ¶
func (TestResourceHandler) GetResource ¶
func (t TestResourceHandler) GetResource(scope api.ResourceScope, options ...api.URIOption) (*models.Resource, error)