mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 04:15:28 +02:00
feat(edge/update): select endpoints to update [EE-4043] (#7602)
This commit is contained in:
parent
36e7981ab7
commit
4d123895ea
37 changed files with 1192 additions and 130 deletions
|
@ -15,14 +15,14 @@ import (
|
|||
|
||||
const contextKey = "edgeUpdateSchedule_item"
|
||||
|
||||
// Handler is the HTTP handler used to handle edge environment(endpoint) operations.
|
||||
// Handler is the HTTP handler used to handle edge environment update operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
requestBouncer *security.RequestBouncer
|
||||
dataStore dataservices.DataStore
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage environment(endpoint) operations.
|
||||
// NewHandler creates a handler to manage environment update operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer, dataStore dataservices.DataStore) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
@ -40,6 +40,15 @@ func NewHandler(bouncer *security.RequestBouncer, dataStore dataservices.DataSto
|
|||
router.Handle("",
|
||||
httperror.LoggerHandler(h.create)).Methods(http.MethodPost)
|
||||
|
||||
router.Handle("/active",
|
||||
httperror.LoggerHandler(h.activeSchedules)).Methods(http.MethodPost)
|
||||
|
||||
router.Handle("/agent_versions",
|
||||
httperror.LoggerHandler(h.agentVersions)).Methods(http.MethodGet)
|
||||
|
||||
router.Handle("/previous_versions",
|
||||
httperror.LoggerHandler(h.previousVersions)).Methods(http.MethodGet)
|
||||
|
||||
itemRouter := router.PathPrefix("/{id}").Subrouter()
|
||||
itemRouter.Use(middlewares.WithItem(func(id edgetypes.UpdateScheduleID) (*edgetypes.UpdateSchedule, error) {
|
||||
return dataStore.EdgeUpdateSchedule().Item(id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue