Record project continuation changes
This commit is contained in:
@@ -40,6 +40,9 @@ func (m *Module) Name() string {
|
||||
|
||||
func (m *Module) RegisterRoutes(router chi.Router) {
|
||||
router.Route("/node-agents", func(r chi.Router) {
|
||||
r.Post("/docker-install-profile", m.dockerInstallProfile)
|
||||
r.Post("/windows-install-profile", m.windowsInstallProfile)
|
||||
r.Post("/linux-install-profile", m.linuxInstallProfile)
|
||||
r.Post("/enroll", m.enrollAgent)
|
||||
r.Post("/enrollments/{requestID}/bootstrap", m.bootstrapEnrollment)
|
||||
r.Post("/register", m.registerAgent)
|
||||
@@ -53,6 +56,48 @@ func (m *Module) RegisterRoutes(router chi.Router) {
|
||||
})
|
||||
}
|
||||
|
||||
func (m *Module) linuxInstallProfile(w http.ResponseWriter, r *http.Request) {
|
||||
var payload clustermodule.DockerInstallProfileRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
httpx.WriteError(w, http.StatusBadRequest, "invalid linux install profile payload")
|
||||
return
|
||||
}
|
||||
profile, err := m.cluster.GetLinuxInstallProfile(r.Context(), payload)
|
||||
if err != nil {
|
||||
httpx.WriteError(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.WriteJSON(w, http.StatusOK, map[string]any{"linux_install_profile": profile})
|
||||
}
|
||||
|
||||
func (m *Module) windowsInstallProfile(w http.ResponseWriter, r *http.Request) {
|
||||
var payload clustermodule.DockerInstallProfileRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
httpx.WriteError(w, http.StatusBadRequest, "invalid windows install profile payload")
|
||||
return
|
||||
}
|
||||
profile, err := m.cluster.GetWindowsInstallProfile(r.Context(), payload)
|
||||
if err != nil {
|
||||
httpx.WriteError(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.WriteJSON(w, http.StatusOK, map[string]any{"windows_install_profile": profile})
|
||||
}
|
||||
|
||||
func (m *Module) dockerInstallProfile(w http.ResponseWriter, r *http.Request) {
|
||||
var payload clustermodule.DockerInstallProfileRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
httpx.WriteError(w, http.StatusBadRequest, "invalid docker install profile payload")
|
||||
return
|
||||
}
|
||||
profile, err := m.cluster.GetDockerInstallProfile(r.Context(), payload)
|
||||
if err != nil {
|
||||
httpx.WriteError(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.WriteJSON(w, http.StatusOK, map[string]any{"docker_install_profile": profile})
|
||||
}
|
||||
|
||||
func (m *Module) enrollAgent(w http.ResponseWriter, r *http.Request) {
|
||||
var payload struct {
|
||||
ClusterID string `json:"cluster_id"`
|
||||
|
||||
Reference in New Issue
Block a user