mirror of
https://github.com/spaytac/orbiter.git
synced 2026-01-21 22:04:42 +00:00
30 lines
534 B
Go
30 lines
534 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/sarkk0x0/orbiter/autoscaler"
|
|
)
|
|
|
|
type AutoscalerResponse struct {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
func AutoscalerList(scalers autoscaler.Autoscalers) func(w http.ResponseWriter, r *http.Request) {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
l := []AutoscalerResponse{}
|
|
for n, _ := range scalers {
|
|
c := AutoscalerResponse{
|
|
Name: n,
|
|
}
|
|
l = append(l, c)
|
|
}
|
|
cc := &CollectionResponse{
|
|
Data: l,
|
|
}
|
|
b, _ := json.Marshal(cc)
|
|
w.Write(b)
|
|
}
|
|
}
|