mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
feat(dashboard): dashboard api [EE-7111] (#11843)
This commit is contained in:
parent
659abe553d
commit
9cef912c44
11 changed files with 695 additions and 69 deletions
37
api/http/handler/kubernetes/dashboard.go
Normal file
37
api/http/handler/kubernetes/dashboard.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package kubernetes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
httperror "github.com/portainer/portainer/pkg/libhttp/error"
|
||||
"github.com/portainer/portainer/pkg/libhttp/response"
|
||||
)
|
||||
|
||||
// @id GetKubernetesDashboard
|
||||
// @summary Get the dashboard summary data
|
||||
// @description Get the dashboard summary data which is simply a count of a range of different commonly used kubernetes resources
|
||||
// @description **Access policy**: authenticated
|
||||
// @tags kubernetes
|
||||
// @security ApiKeyAuth
|
||||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Environment (Endpoint) identifier"
|
||||
// @success 200 {array} kubernetes.K8sDashboard "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 500 "Server error"
|
||||
// @router /kubernetes/{id}/dashboard [get]
|
||||
func (handler *Handler) getKubernetesDashboard(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
||||
cli, httpErr := handler.getProxyKubeClient(r)
|
||||
if httpErr != nil {
|
||||
return httpErr
|
||||
}
|
||||
|
||||
dashboard, err := cli.GetDashboard()
|
||||
if err != nil {
|
||||
return httperror.InternalServerError("Unable to retrieve dashboard data", err)
|
||||
}
|
||||
|
||||
return response.JSON(w, dashboard)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue