mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
listeners and special handlers improvements (#412)
* listeners and special handlers improvements * update runnerListener methods * typo
This commit is contained in:
@@ -28,8 +28,8 @@ func (c *myCustomListener) AfterAppCreate(ctx context.Context, app *models.App)
|
||||
func (c *myCustomListener) BeforeAppUpdate(ctx context.Context, app *models.App) error { return nil }
|
||||
func (c *myCustomListener) AfterAppUpdate(ctx context.Context, app *models.App) error { return nil }
|
||||
|
||||
func (c *myCustomListener) BeforeAppDelete(ctx context.Context, appName string) error { return nil }
|
||||
func (c *myCustomListener) BeforeAppDelete(ctx context.Context, appName string) error { return nil }
|
||||
func (c *myCustomListener) BeforeAppDelete(ctx context.Context, app *models.App) error { return nil }
|
||||
func (c *myCustomListener) BeforeAppDelete(ctx context.Context, app *models.App) error { return nil }
|
||||
|
||||
function main () {
|
||||
srv := server.New(/* Here all required parameters to initialize the server */)
|
||||
@@ -42,12 +42,14 @@ function main () {
|
||||
}
|
||||
```
|
||||
|
||||
#### Listener Requirements
|
||||
|
||||
To be a valid listener your struct should respect interfaces combined or alone found in the file [listeners.go](/iron-io/functions/blob/master/api/ifaces/listeners.go)
|
||||
### Creating a Listener
|
||||
|
||||
These are all available listeners:
|
||||
|
||||
#### App Listeners
|
||||
|
||||
To be a valid listener your struct should respect interfaces combined or alone found [in this file](/iron-io/functions/blob/master/api/server/apps_listeners.go)
|
||||
|
||||
##### AppCreateListener
|
||||
|
||||
_Triggers before and after every app creation that happens in the API_
|
||||
@@ -71,7 +73,20 @@ _Triggers before and after every app deletion that happens in the API_
|
||||
|
||||
Triggered during requests to the following routes:
|
||||
|
||||
- DELETE /v1/apps/app
|
||||
- DELETE /v1/apps/:app
|
||||
|
||||
#### Runner Listeners
|
||||
|
||||
To be a valid listener your struct should respect interfaces combined or alone found [in this file](/iron-io/functions/blob/master/api/server/runner_listeners.go).
|
||||
|
||||
##### RunnerListener
|
||||
|
||||
_Triggers before and after every function run_
|
||||
|
||||
Triggered during requests to the following routes:
|
||||
|
||||
- GET /r/:app/:route
|
||||
- POST /r/:app/:route
|
||||
|
||||
## Special Handlers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user