GetConfig returns Configurer plugin configuration in YAML format. swagger:operation GET /plugin/{id}/config plugin getPluginConfig Get YAML configuration for Configurer plugin. --- consumes: [application/json] produces: [application/x-yaml] parameters: - name: id in: path description: t
(ctx *gin.Context)
| 301 | // schema: |
| 302 | // $ref: "#/definitions/Error" |
| 303 | func (c *PluginAPI) GetConfig(ctx *gin.Context) { |
| 304 | withID(ctx, "id", func(id uint) { |
| 305 | conf, err := c.DB.GetPluginConfByID(id) |
| 306 | if success := successOrAbort(ctx, 500, err); !success { |
| 307 | return |
| 308 | } |
| 309 | if conf == nil || !isPluginOwner(ctx, conf) { |
| 310 | ctx.AbortWithError(404, errors.New("unknown plugin")) |
| 311 | return |
| 312 | } |
| 313 | instance, err := c.Manager.Instance(id) |
| 314 | if err != nil { |
| 315 | ctx.AbortWithError(404, errors.New("plugin instance not found")) |
| 316 | return |
| 317 | } |
| 318 | |
| 319 | if aborted := supportOrAbort(ctx, instance, compat.Configurer); aborted { |
| 320 | return |
| 321 | } |
| 322 | |
| 323 | ctx.Header("content-type", "application/x-yaml") |
| 324 | ctx.Writer.Write(conf.Config) |
| 325 | }) |
| 326 | } |
| 327 | |
| 328 | // UpdateConfig updates Configurer plugin configuration in YAML format. |
| 329 | // swagger:operation POST /plugin/{id}/config plugin updatePluginConfig |