mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
refactor(edge): move stack response to a shared config [EE-5564] (#9033)
This commit is contained in:
parent
9d3f13ac92
commit
79822e1d3b
2 changed files with 52 additions and 11 deletions
|
@ -10,19 +10,12 @@ import (
|
|||
"github.com/portainer/libhttp/request"
|
||||
"github.com/portainer/libhttp/response"
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
"github.com/portainer/portainer/api/edge"
|
||||
"github.com/portainer/portainer/api/http/middlewares"
|
||||
"github.com/portainer/portainer/api/internal/endpointutils"
|
||||
"github.com/portainer/portainer/api/kubernetes"
|
||||
)
|
||||
|
||||
type configResponse struct {
|
||||
StackFileContent string
|
||||
DotEnvFileContent string
|
||||
Name string
|
||||
// Namespace to use for Kubernetes manifests, leave empty to use the namespaces defined in the manifest
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// @summary Inspect an Edge Stack for an Environment(Endpoint)
|
||||
// @description **Access policy**: public
|
||||
// @tags edge, endpoints, edge_stacks
|
||||
|
@ -30,7 +23,7 @@ type configResponse struct {
|
|||
// @produce json
|
||||
// @param id path int true "environment(endpoint) Id"
|
||||
// @param stackId path int true "EdgeStack Id"
|
||||
// @success 200 {object} configResponse
|
||||
// @success 200 {object} edge.StackPayload
|
||||
// @failure 500
|
||||
// @failure 400
|
||||
// @failure 404
|
||||
|
@ -92,9 +85,9 @@ func (handler *Handler) endpointEdgeStackInspect(w http.ResponseWriter, r *http.
|
|||
}
|
||||
}
|
||||
|
||||
return response.JSON(w, configResponse{
|
||||
StackFileContent: string(stackFileContent),
|
||||
return response.JSON(w, edge.StackPayload{
|
||||
DotEnvFileContent: string(dotEnvFileContent),
|
||||
FileContent: string(stackFileContent),
|
||||
Name: edgeStack.Name,
|
||||
Namespace: namespace,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue