complement/cmd/homerunner/route_destroy.go
Kegsay 665c1dd08b
Add 'homerunner' (#58)
* Add cmd/homerunner which supports creating/destroying HS images

* Use blueprints instead of just HS images

* Implement expiry and cleanup

* Add ability to keep images created from blueprints

* Add perf_many_messages with 7000 messages in one room

* goimports

* Add perf_many_rooms

* Bump timers
2020-12-22 17:48:30 +00:00

29 lines
581 B
Go

package main
import (
"context"
"fmt"
"github.com/matrix-org/util"
)
type ReqDestroy struct {
BlueprintName string `json:"blueprint_name"`
}
type ResDestroy struct {
}
func RouteDestroy(ctx context.Context, rt *Runtime, rc *ReqDestroy) util.JSONResponse {
if rc.BlueprintName == "" {
return util.MessageResponse(400, "missing blueprint name")
}
err := rt.DestroyDeployment(rc.BlueprintName)
if err != nil {
return util.MessageResponse(500, fmt.Sprintf("failed to destroy deployment: %s", err))
}
return util.JSONResponse{
Code: 200,
JSON: ResDestroy{},
}
}