mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(swagger): fix swagger api docs endpoint(s) rename to environment(s) EE-1661 (#5629)
* fix swagger api docs endpoint(s) rename to environment(s)
This commit is contained in:
parent
d911c50f1b
commit
dd808bb7bd
111 changed files with 376 additions and 376 deletions
|
@ -102,7 +102,7 @@ func Get(url string, timeout int) ([]byte, error) {
|
|||
return body, nil
|
||||
}
|
||||
|
||||
// ExecutePingOperation will send a SystemPing operation HTTP request to a Docker environment
|
||||
// ExecutePingOperation will send a SystemPing operation HTTP request to a Docker environment(endpoint)
|
||||
// using the specified host and optional TLS configuration.
|
||||
// It uses a new Http.Client for each operation.
|
||||
func ExecutePingOperation(host string, tlsConfig *tls.Config) (bool, error) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package errors
|
|||
import "errors"
|
||||
|
||||
var (
|
||||
// ErrEndpointAccessDenied Access denied to endpoint error
|
||||
// ErrEndpointAccessDenied Access denied to environment(endpoint) error
|
||||
ErrEndpointAccessDenied = errors.New("Access denied to environment")
|
||||
// ErrUnauthorized Unauthorized error
|
||||
ErrUnauthorized = errors.New("Unauthorized")
|
||||
|
|
|
@ -39,7 +39,7 @@ func (payload *authenticatePayload) Validate(r *http.Request) error {
|
|||
|
||||
// @id AuthenticateUser
|
||||
// @summary Authenticate
|
||||
// @description Use this endpoint to authenticate against Portainer using a username and password.
|
||||
// @description Use this environment(endpoint) to authenticate against Portainer using a username and password.
|
||||
// @tags auth
|
||||
// @accept json
|
||||
// @produce json
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/portainer/portainer/api/internal/authorization"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler used to handle endpoint group operations.
|
||||
// Handler is the HTTP handler used to handle environment(endpoint) group operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
DataStore portainer.DataStore
|
||||
|
@ -18,7 +18,7 @@ type Handler struct {
|
|||
GitService portainer.GitService
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint group operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) group operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
|
|
@ -9,13 +9,13 @@ import (
|
|||
"github.com/portainer/portainer/api/http/security"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler used to handle endpoint group operations.
|
||||
// Handler is the HTTP handler used to handle environment(endpoint) group operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
DataStore portainer.DataStore
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint group operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) group operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
|
|
@ -67,8 +67,8 @@ type swarmStackFromFileContentPayload struct {
|
|||
EdgeGroups []portainer.EdgeGroupID `example:"1"`
|
||||
// Deployment type to deploy this stack
|
||||
// Valid values are: 0 - 'compose', 1 - 'kubernetes'
|
||||
// for compose stacks will use kompose to convert to kubernetes manifest for kubernetes endpoints
|
||||
// kubernetes deploytype is enabled only for kubernetes endpoints
|
||||
// for compose stacks will use kompose to convert to kubernetes manifest for kubernetes environments(endpoints)
|
||||
// kubernetes deploytype is enabled only for kubernetes environments(endpoints)
|
||||
DeploymentType portainer.EdgeStackDeploymentType `example:"0" enums:"0,1"`
|
||||
}
|
||||
|
||||
|
@ -185,8 +185,8 @@ type swarmStackFromGitRepositoryPayload struct {
|
|||
EdgeGroups []portainer.EdgeGroupID `example:"1"`
|
||||
// Deployment type to deploy this stack
|
||||
// Valid values are: 0 - 'compose', 1 - 'kubernetes'
|
||||
// for compose stacks will use kompose to convert to kubernetes manifest for kubernetes endpoints
|
||||
// kubernetes deploytype is enabled only for kubernetes endpoints
|
||||
// for compose stacks will use kompose to convert to kubernetes manifest for kubernetes environments(endpoints)
|
||||
// kubernetes deploytype is enabled only for kubernetes environments(endpoints)
|
||||
DeploymentType portainer.EdgeStackDeploymentType `example:"0" enums:"0,1"`
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ func (handler *Handler) validateUniqueName(name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// updateEndpointRelations adds a relation between the Edge Stack to the related endpoints
|
||||
// updateEndpointRelations adds a relation between the Edge Stack to the related environments(endpoints)
|
||||
func updateEndpointRelations(endpointRelationService portainer.EndpointRelationService, edgeStackID portainer.EdgeStackID, relatedEndpointIds []portainer.EndpointID) error {
|
||||
for _, endpointID := range relatedEndpointIds {
|
||||
relation, err := endpointRelationService.EndpointRelation(endpointID)
|
||||
|
|
|
@ -33,7 +33,7 @@ func (payload *updateStatusPayload) Validate(r *http.Request) error {
|
|||
|
||||
// @id EdgeStackStatusUpdate
|
||||
// @summary Update an EdgeStack status
|
||||
// @description Authorized only if the request is done by an Edge Endpoint
|
||||
// @description Authorized only if the request is done by an Edge Environment(Endpoint)
|
||||
// @tags edge_stacks
|
||||
// @accept json
|
||||
// @produce json
|
||||
|
|
|
@ -164,11 +164,11 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request)
|
|||
|
||||
hasDockerEndpoint, err := hasDockerEndpoint(handler.DataStore.Endpoint(), relatedEndpointIds)
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to check for existence of docker endpoint", err}
|
||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to check for existence of docker environment", err}
|
||||
}
|
||||
|
||||
if hasDockerEndpoint {
|
||||
return &httperror.HandlerError{http.StatusBadRequest, "Edge stack with docker endpoint cannot be deployed with kubernetes config", err}
|
||||
return &httperror.HandlerError{http.StatusBadRequest, "Edge stack with docker environment cannot be deployed with kubernetes config", err}
|
||||
}
|
||||
|
||||
_, err = handler.FileService.StoreEdgeStackFileFromBytes(stackFolder, stack.ManifestPath, []byte(payload.StackFileContent))
|
||||
|
|
|
@ -19,7 +19,7 @@ func hasEndpointPredicate(endpointService portainer.EndpointService, endpointIDs
|
|||
for _, endpointID := range endpointIDs {
|
||||
endpoint, err := endpointService.Endpoint(endpointID)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to retrieve endpoint from database: %w", err)
|
||||
return false, fmt.Errorf("failed to retrieve environment from database: %w", err)
|
||||
}
|
||||
|
||||
if predicate(endpoint) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/portainer/portainer/api/http/security"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler used to handle endpoint group operations.
|
||||
// Handler is the HTTP handler used to handle environment(endpoint) group operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
requestBouncer *security.RequestBouncer
|
||||
|
@ -23,7 +23,7 @@ type Handler struct {
|
|||
KubernetesDeployer portainer.KubernetesDeployer
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint group operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) group operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
@ -49,7 +49,7 @@ func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
|||
func (handler *Handler) convertAndStoreKubeManifestIfNeeded(edgeStack *portainer.EdgeStack, relatedEndpointIds []portainer.EndpointID) error {
|
||||
hasKubeEndpoint, err := hasKubeEndpoint(handler.DataStore.Endpoint(), relatedEndpointIds)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to check if edge stack has kube endpoints: %w", err)
|
||||
return fmt.Errorf("unable to check if edge stack has kube environments: %w", err)
|
||||
}
|
||||
|
||||
if !hasKubeEndpoint {
|
||||
|
|
|
@ -10,14 +10,14 @@ import (
|
|||
"github.com/portainer/portainer/api/http/security"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler used to handle edge endpoint operations.
|
||||
// Handler is the HTTP handler used to handle edge environment(endpoint) operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
requestBouncer *security.RequestBouncer
|
||||
DataStore portainer.DataStore
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
|
|
@ -25,7 +25,7 @@ func (payload *logsPayload) Validate(r *http.Request) error {
|
|||
// @tags edge, endpoints
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path string true "Endpoint Id"
|
||||
// @param id path string true "environment(endpoint) Id"
|
||||
// @param jobID path string true "Job Id"
|
||||
// @success 200
|
||||
// @failure 500
|
||||
|
|
|
@ -18,12 +18,12 @@ type configResponse struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
// @summary Inspect an Edge Stack for an Endpoint
|
||||
// @summary Inspect an Edge Stack for an Environment(Endpoint)
|
||||
// @description
|
||||
// @tags edge, endpoints, edge_stacks
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path string true "Endpoint Id"
|
||||
// @param id path string true "environment(endpoint) Id"
|
||||
// @param stackId path string true "EdgeStack Id"
|
||||
// @success 200 {object} configResponse
|
||||
// @failure 500
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/portainer/portainer/api/http/security"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler used to handle edge endpoint operations.
|
||||
// Handler is the HTTP handler used to handle edge environment(endpoint) operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
requestBouncer *security.RequestBouncer
|
||||
|
@ -19,7 +19,7 @@ type Handler struct {
|
|||
ReverseTunnelService portainer.ReverseTunnelService
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
|
|
@ -12,13 +12,13 @@ import (
|
|||
)
|
||||
|
||||
type endpointGroupCreatePayload struct {
|
||||
// Endpoint group name
|
||||
Name string `validate:"required" example:"my-endpoint-group"`
|
||||
// Endpoint group description
|
||||
// Environment(Endpoint) group name
|
||||
Name string `validate:"required" example:"my-environment-group"`
|
||||
// Environment(Endpoint) group description
|
||||
Description string `example:"description"`
|
||||
// List of endpoint identifiers that will be part of this group
|
||||
// List of environment(endpoint) identifiers that will be part of this group
|
||||
AssociatedEndpoints []portainer.EndpointID `example:"1,3"`
|
||||
// List of tag identifiers to which this endpoint group is associated
|
||||
// List of tag identifiers to which this environment(endpoint) group is associated
|
||||
TagIDs []portainer.TagID `example:"1,2"`
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,14 @@ func (payload *endpointGroupCreatePayload) Validate(r *http.Request) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// @summary Create an Endpoint Group
|
||||
// @description Create a new endpoint group.
|
||||
// @summary Create an Environment(Endpoint) Group
|
||||
// @description Create a new environment(endpoint) group.
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param body body endpointGroupCreatePayload true "Endpoint Group details"
|
||||
// @param body body endpointGroupCreatePayload true "Environment(Endpoint) Group details"
|
||||
// @success 200 {object} portainer.EndpointGroup "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 500 "Server error"
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointGroupDelete
|
||||
// @summary Remove an endpoint group
|
||||
// @description Remove an endpoint group.
|
||||
// @summary Remove an environment(endpoint) group
|
||||
// @description Remove an environment(endpoint) group.
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
|
|
|
@ -11,13 +11,13 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointGroupAddEndpoint
|
||||
// @summary Add an endpoint to an endpoint group
|
||||
// @description Add an endpoint to an endpoint group
|
||||
// @summary Add an environment(endpoint) to an environment(endpoint) group
|
||||
// @description Add an environment(endpoint) to an environment(endpoint) group
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
// @param id path int true "EndpointGroup identifier"
|
||||
// @param endpointId path int true "Endpoint identifier"
|
||||
// @param endpointId path int true "Environment(Endpoint) identifier"
|
||||
// @success 204 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "EndpointGroup not found"
|
||||
|
|
|
@ -11,12 +11,12 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointGroupDeleteEndpoint
|
||||
// @summary Removes endpoint from an endpoint group
|
||||
// @summary Removes environment(endpoint) from an environment(endpoint) group
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
// @param id path int true "EndpointGroup identifier"
|
||||
// @param endpointId path int true "Endpoint identifier"
|
||||
// @param endpointId path int true "Environment(Endpoint) identifier"
|
||||
// @success 204 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "EndpointGroup not found"
|
||||
|
|
|
@ -10,14 +10,14 @@ import (
|
|||
"github.com/portainer/portainer/api/bolt/errors"
|
||||
)
|
||||
|
||||
// @summary Inspect an Endpoint group
|
||||
// @description Retrieve details abont an endpoint group.
|
||||
// @summary Inspect an Environment(Endpoint) group
|
||||
// @description Retrieve details abont an environment(endpoint) group.
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint group identifier"
|
||||
// @param id path int true "Environment(Endpoint) group identifier"
|
||||
// @success 200 {object} portainer.EndpointGroup "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "EndpointGroup not found"
|
||||
|
|
|
@ -9,15 +9,15 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointGroupList
|
||||
// @summary List Endpoint groups
|
||||
// @description List all endpoint groups based on the current user authorizations. Will
|
||||
// @description return all endpoint groups if using an administrator account otherwise it will
|
||||
// @description only return authorized endpoint groups.
|
||||
// @summary List Environment(Endpoint) groups
|
||||
// @description List all environment(endpoint) groups based on the current user authorizations. Will
|
||||
// @description return all environment(endpoint) groups if using an administrator account otherwise it will
|
||||
// @description only return authorized environment(endpoint) groups.
|
||||
// @description **Access policy**: restricted
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
// @produce json
|
||||
// @success 200 {array} portainer.EndpointGroup "Endpoint group"
|
||||
// @success 200 {array} portainer.EndpointGroup "Environment(Endpoint) group"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoint_groups [get]
|
||||
func (handler *Handler) endpointGroupList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -13,11 +13,11 @@ import (
|
|||
)
|
||||
|
||||
type endpointGroupUpdatePayload struct {
|
||||
// Endpoint group name
|
||||
Name string `example:"my-endpoint-group"`
|
||||
// Endpoint group description
|
||||
// Environment(Endpoint) group name
|
||||
Name string `example:"my-environment-group"`
|
||||
// Environment(Endpoint) group description
|
||||
Description string `example:"description"`
|
||||
// List of tag identifiers associated to the endpoint group
|
||||
// List of tag identifiers associated to the environment(endpoint) group
|
||||
TagIDs []portainer.TagID `example:"3,4"`
|
||||
UserAccessPolicies portainer.UserAccessPolicies
|
||||
TeamAccessPolicies portainer.TeamAccessPolicies
|
||||
|
@ -28,8 +28,8 @@ func (payload *endpointGroupUpdatePayload) Validate(r *http.Request) error {
|
|||
}
|
||||
|
||||
// @id EndpointGroupUpdate
|
||||
// @summary Update an endpoint group
|
||||
// @description Update an endpoint group.
|
||||
// @summary Update an environment(endpoint) group
|
||||
// @description Update an environment(endpoint) group.
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoint_groups
|
||||
// @security jwt
|
||||
|
|
|
@ -10,14 +10,14 @@ import (
|
|||
"github.com/portainer/portainer/api/http/security"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler used to handle endpoint group operations.
|
||||
// Handler is the HTTP handler used to handle environment(endpoint) group operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
AuthorizationService *authorization.Service
|
||||
DataStore portainer.DataStore
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint group operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) group operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
|
|
@ -16,16 +16,16 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointAssociationDelete
|
||||
// @summary De-association an edge endpoint
|
||||
// @description De-association an edge endpoint.
|
||||
// @summary De-association an edge environment(endpoint)
|
||||
// @description De-association an edge environment(endpoint).
|
||||
// @description **Access policy**: administrator
|
||||
// @security jwt
|
||||
// @tags endpoints
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 200 {object} portainer.Endpoint "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /api/endpoints/{id}/association [put]
|
||||
func (handler *Handler) endpointAssociationDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -148,28 +148,28 @@ func (payload *endpointCreatePayload) Validate(r *http.Request) error {
|
|||
}
|
||||
|
||||
// @id EndpointCreate
|
||||
// @summary Create a new endpoint
|
||||
// @description Create a new endpoint that will be used to manage an environment.
|
||||
// @summary Create a new environment(endpoint)
|
||||
// @description Create a new environment(endpoint) that will be used to manage an environment(endpoint).
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
// @accept multipart/form-data
|
||||
// @produce json
|
||||
// @param Name formData string true "Name that will be used to identify this endpoint (example: my-endpoint)"
|
||||
// @param EndpointCreationType formData integer true "Environment type. Value must be one of: 1 (Local Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge agent environment) or 5 (Local Kubernetes Environment" Enum(1,2,3,4,5)
|
||||
// @param Name formData string true "Name that will be used to identify this environment(endpoint) (example: my-environment)"
|
||||
// @param EndpointCreationType formData integer true "Environment(Endpoint) type. Value must be one of: 1 (Local Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge agent environment) or 5 (Local Kubernetes Environment" Enum(1,2,3,4,5)
|
||||
// @param URL formData string false "URL or IP address of a Docker host (example: docker.mydomain.tld:2375). Defaults to local if not specified (Linux: /var/run/docker.sock, Windows: //./pipe/docker_engine)"
|
||||
// @param PublicURL formData string false "URL or IP address where exposed containers will be reachable. Defaults to URL if not specified (example: docker.mydomain.tld:2375)"
|
||||
// @param GroupID formData int false "Endpoint group identifier. If not specified will default to 1 (unassigned)."
|
||||
// @param TLS formData bool false "Require TLS to connect against this endpoint"
|
||||
// @param GroupID formData int false "Environment(Endpoint) group identifier. If not specified will default to 1 (unassigned)."
|
||||
// @param TLS formData bool false "Require TLS to connect against this environment(endpoint)"
|
||||
// @param TLSSkipVerify formData bool false "Skip server verification when using TLS"
|
||||
// @param TLSSkipClientVerify formData bool false "Skip client verification when using TLS"
|
||||
// @param TLSCACertFile formData file false "TLS CA certificate file"
|
||||
// @param TLSCertFile formData file false "TLS client certificate file"
|
||||
// @param TLSKeyFile formData file false "TLS client key file"
|
||||
// @param AzureApplicationID formData string false "Azure application ID. Required if endpoint type is set to 3"
|
||||
// @param AzureTenantID formData string false "Azure tenant ID. Required if endpoint type is set to 3"
|
||||
// @param AzureAuthenticationKey formData string false "Azure authentication key. Required if endpoint type is set to 3"
|
||||
// @param TagIDs formData []int false "List of tag identifiers to which this endpoint is associated"
|
||||
// @param AzureApplicationID formData string false "Azure application ID. Required if environment(endpoint) type is set to 3"
|
||||
// @param AzureTenantID formData string false "Azure tenant ID. Required if environment(endpoint) type is set to 3"
|
||||
// @param AzureAuthenticationKey formData string false "Azure authentication key. Required if environment(endpoint) type is set to 3"
|
||||
// @param TagIDs formData []int false "List of tag identifiers to which this environment(endpoint) is associated"
|
||||
// @param EdgeCheckinInterval formData int false "The check in interval for edge agent (in seconds)"
|
||||
// @success 200 {object} portainer.Endpoint "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
|
|
|
@ -12,15 +12,15 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointDelete
|
||||
// @summary Remove an endpoint
|
||||
// @description Remove an endpoint.
|
||||
// @summary Remove an environment(endpoint)
|
||||
// @description Remove an environment(endpoint).
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 204 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id} [delete]
|
||||
func (handler *Handler) endpointDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -11,16 +11,16 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointInspect
|
||||
// @summary Inspect an endpoint
|
||||
// @description Retrieve details about an endpoint.
|
||||
// @summary Inspect an environment(endpoint)
|
||||
// @description Retrieve details about an environment(endpoint).
|
||||
// @description **Access policy**: restricted
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 200 {object} portainer.Endpoint "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id} [get]
|
||||
func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -14,22 +14,22 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointList
|
||||
// @summary List endpoints
|
||||
// @description List all endpoints based on the current user authorizations. Will
|
||||
// @description return all endpoints if using an administrator account otherwise it will
|
||||
// @description only return authorized endpoints.
|
||||
// @summary List environments(endpoints)
|
||||
// @description List all environments(endpoints) based on the current user authorizations. Will
|
||||
// @description return all environments(endpoints) if using an administrator account otherwise it will
|
||||
// @description only return authorized environments(endpoints).
|
||||
// @description **Access policy**: restricted
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
// @produce json
|
||||
// @param start query int false "Start searching from"
|
||||
// @param search query string false "Search query"
|
||||
// @param groupId query int false "List endpoints of this group"
|
||||
// @param groupId query int false "List environments(endpoints) of this group"
|
||||
// @param limit query int false "Limit results to this value"
|
||||
// @param types query []int false "List endpoints of this type"
|
||||
// @param tagIds query []int false "search endpoints with these tags (depends on tagsPartialMatch)"
|
||||
// @param tagsPartialMatch query bool false "If true, will return endpoint which has one of tagIds, if false (or missing) will return only endpoints that has all the tags"
|
||||
// @param endpointIds query []int false "will return only these endpoints"
|
||||
// @param types query []int false "List environments(endpoints) of this type"
|
||||
// @param tagIds query []int false "search environments(endpoints) with these tags (depends on tagsPartialMatch)"
|
||||
// @param tagsPartialMatch query bool false "If true, will return environment(endpoint) which has one of tagIds, if false (or missing) will return only environments(endpoints) that has all the tags"
|
||||
// @param endpointIds query []int false "will return only these environments(endpoints)"
|
||||
// @success 200 {array} portainer.Endpoint "Endpoints"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints [get]
|
||||
|
|
|
@ -36,18 +36,18 @@ func (payload *endpointSettingsUpdatePayload) Validate(r *http.Request) error {
|
|||
}
|
||||
|
||||
// @id EndpointSettingsUpdate
|
||||
// @summary Update settings for an endpoint
|
||||
// @description Update settings for an endpoint.
|
||||
// @summary Update settings for an environments(endpoints)
|
||||
// @description Update settings for an environments(endpoints).
|
||||
// @description **Access policy**: administrator
|
||||
// @security jwt
|
||||
// @tags endpoints
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param body body endpointSettingsUpdatePayload true "Endpoint details"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param body body endpointSettingsUpdatePayload true "Environment(Endpoint) details"
|
||||
// @success 200 {object} portainer.Endpoint "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /api/endpoints/{id}/settings [put]
|
||||
func (handler *Handler) endpointSettingsUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -12,15 +12,15 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointSnapshot
|
||||
// @summary Snapshots an endpoint
|
||||
// @description Snapshots an endpoint
|
||||
// @summary Snapshots an environments(endpoints)
|
||||
// @description Snapshots an environments(endpoints)
|
||||
// @description **Access policy**: restricted
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 204 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id}/snapshot [post]
|
||||
func (handler *Handler) endpointSnapshot(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
)
|
||||
|
||||
// @id EndpointSnapshots
|
||||
// @summary Snapshot all endpoints
|
||||
// @description Snapshot all endpoints
|
||||
// @summary Snapshot all environments(endpoints)
|
||||
// @description Snapshot all environments(endpoints)
|
||||
// @description **Access policy**: administrator
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
|
|
|
@ -35,31 +35,31 @@ type edgeJobResponse struct {
|
|||
}
|
||||
|
||||
type endpointStatusInspectResponse struct {
|
||||
// Status represents the endpoint status
|
||||
// Status represents the environment(endpoint) status
|
||||
Status string `json:"status" example:"REQUIRED"`
|
||||
// The tunnel port
|
||||
Port int `json:"port" example:"8732"`
|
||||
// List of requests for jobs to run on the endpoint
|
||||
// List of requests for jobs to run on the environment(endpoint)
|
||||
Schedules []edgeJobResponse `json:"schedules"`
|
||||
// The current value of CheckinInterval
|
||||
CheckinInterval int `json:"checkin" example:"5"`
|
||||
//
|
||||
Credentials string `json:"credentials" example:""`
|
||||
// List of stacks to be deployed on the endpoints
|
||||
// List of stacks to be deployed on the environments(endpoints)
|
||||
Stacks []stackStatusResponse `json:"stacks"`
|
||||
}
|
||||
|
||||
// @id EndpointStatusInspect
|
||||
// @summary Get endpoint status
|
||||
// @description Endpoint for edge agent to check status of environment
|
||||
// @description **Access policy**: restricted only to Edge endpoints
|
||||
// @summary Get environment(endpoint) status
|
||||
// @description Environment(Endpoint) for edge agent to check status of environment(endpoint)
|
||||
// @description **Access policy**: restricted only to Edge environments(endpoints)
|
||||
// @tags endpoints
|
||||
// @security jwt
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 200 {object} endpointStatusInspectResponse "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 403 "Permission denied to access endpoint"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 403 "Permission denied to access environment(endpoint)"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id}/status [get]
|
||||
func (handler *Handler) endpointStatusInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -16,8 +16,8 @@ import (
|
|||
)
|
||||
|
||||
type endpointUpdatePayload struct {
|
||||
// Name that will be used to identify this endpoint
|
||||
Name *string `example:"my-endpoint"`
|
||||
// Name that will be used to identify this environment(endpoint)
|
||||
Name *string `example:"my-environment"`
|
||||
// URL or IP address of a Docker host
|
||||
URL *string `example:"docker.mydomain.tld:2375"`
|
||||
// URL or IP address where exposed containers will be reachable.\
|
||||
|
@ -25,13 +25,13 @@ type endpointUpdatePayload struct {
|
|||
PublicURL *string `example:"docker.mydomain.tld:2375"`
|
||||
// Group identifier
|
||||
GroupID *int `example:"1"`
|
||||
// Require TLS to connect against this endpoint
|
||||
// Require TLS to connect against this environment(endpoint)
|
||||
TLS *bool `example:"true"`
|
||||
// Skip server verification when using TLS
|
||||
TLSSkipVerify *bool `example:"false"`
|
||||
// Skip client verification when using TLS
|
||||
TLSSkipClientVerify *bool `example:"false"`
|
||||
// The status of the endpoint (1 - up, 2 - down)
|
||||
// The status of the environment(endpoint) (1 - up, 2 - down)
|
||||
Status *int `example:"1"`
|
||||
// Azure application ID
|
||||
AzureApplicationID *string `example:"eag7cdo9-o09l-9i83-9dO9-f0b23oe78db4"`
|
||||
|
@ -39,7 +39,7 @@ type endpointUpdatePayload struct {
|
|||
AzureTenantID *string `example:"34ddc78d-4fel-2358-8cc1-df84c8o839f5"`
|
||||
// Azure authentication key
|
||||
AzureAuthenticationKey *string `example:"cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk="`
|
||||
// List of tag identifiers to which this endpoint is associated
|
||||
// List of tag identifiers to which this environment(endpoint) is associated
|
||||
TagIDs []portainer.TagID `example:"1,2"`
|
||||
UserAccessPolicies portainer.UserAccessPolicies
|
||||
TeamAccessPolicies portainer.TeamAccessPolicies
|
||||
|
@ -54,18 +54,18 @@ func (payload *endpointUpdatePayload) Validate(r *http.Request) error {
|
|||
}
|
||||
|
||||
// @id EndpointUpdate
|
||||
// @summary Update an endpoint
|
||||
// @description Update an endpoint.
|
||||
// @summary Update an environment(endpoint)
|
||||
// @description Update an environment(endpoint).
|
||||
// @description **Access policy**: administrator
|
||||
// @security jwt
|
||||
// @tags endpoints
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param body body endpointUpdatePayload true "Endpoint details"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param body body endpointUpdatePayload true "Environment(Endpoint) details"
|
||||
// @success 200 {object} portainer.Endpoint "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id} [put]
|
||||
func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -20,7 +20,7 @@ func hideFields(endpoint *portainer.Endpoint) {
|
|||
}
|
||||
}
|
||||
|
||||
// Handler is the HTTP handler used to handle endpoint operations.
|
||||
// Handler is the HTTP handler used to handle environment(endpoint) operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
requestBouncer *security.RequestBouncer
|
||||
|
@ -36,7 +36,7 @@ type Handler struct {
|
|||
BindAddressHTTPS string
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) operations.
|
||||
func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
|
|
@ -102,11 +102,11 @@ type Handler struct {
|
|||
// @tag.name edge_templates
|
||||
// @tag.description Manage Edge Templates
|
||||
// @tag.name edge
|
||||
// @tag.description Manage Edge related endpoint settings
|
||||
// @tag.description Manage Edge related environment(endpoint) settings
|
||||
// @tag.name endpoints
|
||||
// @tag.description Manage Docker environments
|
||||
// @tag.description Manage Docker environments(endpoints)
|
||||
// @tag.name endpoint_groups
|
||||
// @tag.description Manage endpoint groups
|
||||
// @tag.description Manage environment(endpoint) groups
|
||||
// @tag.name kubernetes
|
||||
// @tag.description Manage Kubernetes cluster
|
||||
// @tag.name motd
|
||||
|
|
|
@ -21,7 +21,7 @@ type requestBouncer interface {
|
|||
AuthenticatedAccess(h http.Handler) http.Handler
|
||||
}
|
||||
|
||||
// Handler is the HTTP handler used to handle endpoint group operations.
|
||||
// Handler is the HTTP handler used to handle environment(endpoint) group operations.
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
requestBouncer requestBouncer
|
||||
|
@ -30,7 +30,7 @@ type Handler struct {
|
|||
helmPackageManager libhelm.HelmPackageManager
|
||||
}
|
||||
|
||||
// NewHandler creates a handler to manage endpoint group operations.
|
||||
// NewHandler creates a handler to manage environment(endpoint) group operations.
|
||||
func NewHandler(bouncer requestBouncer, dataStore portainer.DataStore, helmPackageManager libhelm.HelmPackageManager, kubeConfigService kubernetes.KubeConfigService) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
@ -62,7 +62,7 @@ func NewHandler(bouncer requestBouncer, dataStore portainer.DataStore, helmPacka
|
|||
return h
|
||||
}
|
||||
|
||||
// NewTemplateHandler creates a template handler to manage endpoint group operations.
|
||||
// NewTemplateHandler creates a template handler to manage environment(endpoint) group operations.
|
||||
func NewTemplateHandler(bouncer requestBouncer, helmPackageManager libhelm.HelmPackageManager) *Handler {
|
||||
h := &Handler{
|
||||
Router: mux.NewRouter(),
|
||||
|
@ -86,7 +86,7 @@ func NewTemplateHandler(bouncer requestBouncer, helmPackageManager libhelm.HelmP
|
|||
func (handler *Handler) getHelmClusterAccess(r *http.Request) (*options.KubernetesClusterAccess, *httperror.HandlerError) {
|
||||
endpoint, err := middlewares.FetchEndpoint(r)
|
||||
if err != nil {
|
||||
return nil, &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint on request context", err}
|
||||
return nil, &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment on request context", err}
|
||||
}
|
||||
|
||||
bearerToken, err := security.ExtractBearerToken(r)
|
||||
|
|
|
@ -17,13 +17,13 @@ import (
|
|||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param release path string true "The name of the release/application to uninstall"
|
||||
// @param namespace query string true "An optional namespace"
|
||||
// @success 204 "Success"
|
||||
// @failure 400 "Invalid endpoint id or bad request"
|
||||
// @failure 400 "Invalid environment(endpoint) id or bad request"
|
||||
// @failure 401 "Unauthorized"
|
||||
// @failure 404 "Endpoint or ServiceAccount not found"
|
||||
// @failure 404 "Environment(Endpoint) or ServiceAccount not found"
|
||||
// @failure 500 "Server error or helm error"
|
||||
// @router /endpoints/{id}/kubernetes/helm/{release} [delete]
|
||||
func (handler *Handler) helmDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -24,7 +24,7 @@ func Test_helmDelete(t *testing.T) {
|
|||
defer teardown()
|
||||
|
||||
err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1})
|
||||
is.NoError(err, "Error creating endpoint")
|
||||
is.NoError(err, "Error creating environment")
|
||||
|
||||
err = store.User().CreateUser(&portainer.User{Username: "admin", Role: portainer.AdministratorRole})
|
||||
is.NoError(err, "Error creating a user")
|
||||
|
|
|
@ -36,11 +36,11 @@ var errChartNameInvalid = errors.New("invalid chart name. " +
|
|||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param payload body installChartPayload true "Chart details"
|
||||
// @success 201 {object} release.Release "Created"
|
||||
// @failure 401 "Unauthorized"
|
||||
// @failure 404 "Endpoint or ServiceAccount not found"
|
||||
// @failure 404 "Environment(Endpoint) or ServiceAccount not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id}/kubernetes/helm [post]
|
||||
func (handler *Handler) helmInstall(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -26,7 +26,7 @@ func Test_helmInstall(t *testing.T) {
|
|||
defer teardown()
|
||||
|
||||
err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1})
|
||||
is.NoError(err, "error creating endpoint")
|
||||
is.NoError(err, "error creating environment")
|
||||
|
||||
err = store.User().CreateUser(&portainer.User{Username: "admin", Role: portainer.AdministratorRole})
|
||||
is.NoError(err, "error creating a user")
|
||||
|
|
|
@ -17,14 +17,14 @@ import (
|
|||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param namespace query string true "specify an optional namespace"
|
||||
// @param filter query string true "specify an optional filter"
|
||||
// @param selector query string true "specify an optional selector"
|
||||
// @success 200 {array} release.ReleaseElement "Success"
|
||||
// @failure 400 "Invalid endpoint identifier"
|
||||
// @failure 400 "Invalid environment(endpoint) identifier"
|
||||
// @failure 401 "Unauthorized"
|
||||
// @failure 404 "Endpoint or ServiceAccount not found"
|
||||
// @failure 404 "Environment(Endpoint) or ServiceAccount not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /endpoints/{id}/kubernetes/helm [get]
|
||||
func (handler *Handler) helmList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -23,7 +23,7 @@ func Test_helmList(t *testing.T) {
|
|||
defer teardown()
|
||||
|
||||
err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1})
|
||||
assert.NoError(t, err, "error creating endpoint")
|
||||
assert.NoError(t, err, "error creating environment")
|
||||
|
||||
err = store.User().CreateUser(&portainer.User{Username: "admin", Role: portainer.AdministratorRole})
|
||||
assert.NoError(t, err, "error creating a user")
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
// @produce text/plain
|
||||
// @success 200 {object} string "Success"
|
||||
// @failure 401 "Unauthorized"
|
||||
// @failure 404 "Endpoint or ServiceAccount not found"
|
||||
// @failure 404 "Environment(Endpoint) or ServiceAccount not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /templates/helm/{command} [get]
|
||||
func (handler *Handler) helmShow(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -36,7 +36,7 @@ func (p *addHelmRepoUrlPayload) Validate(_ *http.Request) error {
|
|||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param payload body addHelmRepoUrlPayload true "Helm Repository"
|
||||
// @success 200 {object} portainer.HelmUserRepository "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/portainer/portainer/api/kubernetes/cli"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler which will natively deal with to external endpoints.
|
||||
// Handler is the HTTP handler which will natively deal with to external environments(endpoints).
|
||||
type Handler struct {
|
||||
*mux.Router
|
||||
dataStore portainer.DataStore
|
||||
|
|
|
@ -22,12 +22,12 @@ import (
|
|||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 200 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 401 "Unauthorized"
|
||||
// @failure 403 "Permission denied"
|
||||
// @failure 404 "Endpoint or ServiceAccount not found"
|
||||
// @failure 404 "Environment(Endpoint) or ServiceAccount not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /kubernetes/{id}/config [get]
|
||||
func (handler *Handler) getKubernetesConfig(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -18,12 +18,12 @@ import (
|
|||
// @security jwt
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @success 200 {object} portainer.K8sNodesLimits "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 401 "Unauthorized"
|
||||
// @failure 403 "Permission denied"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /kubernetes/{id}/nodes_limits [get]
|
||||
func (handler *Handler) getKubernetesNodesLimits(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -21,16 +21,16 @@ func (payload *namespacesToggleSystemPayload) Validate(r *http.Request) error {
|
|||
// @id KubernetesNamespacesToggleSystem
|
||||
// @summary Toggle the system state for a namespace
|
||||
// @description Toggle the system state for a namespace
|
||||
// @description **Access policy**: administrator or endpoint admin
|
||||
// @description **Access policy**: administrator or environment(endpoint) admin
|
||||
// @security jwt
|
||||
// @tags kubernetes
|
||||
// @accept json
|
||||
// @param id path int true "Endpoint identifier"
|
||||
// @param id path int true "Environment(Endpoint) identifier"
|
||||
// @param namespace path string true "Namespace name"
|
||||
// @param body body namespacesToggleSystemPayload true "Update details"
|
||||
// @success 200 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 404 "Endpoint not found"
|
||||
// @failure 404 "Environment(Endpoint) not found"
|
||||
// @failure 500 "Server error"
|
||||
// @router /kubernetes/{id}/namespaces/{namespace}/system [put]
|
||||
func (handler *Handler) namespacesToggleSystem(rw http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
|
|
@ -24,7 +24,7 @@ type settingsUpdatePayload struct {
|
|||
AuthenticationMethod *int `example:"1"`
|
||||
LDAPSettings *portainer.LDAPSettings `example:""`
|
||||
OAuthSettings *portainer.OAuthSettings `example:""`
|
||||
// The interval in which endpoint snapshots are created
|
||||
// The interval in which environment(endpoint) snapshots are created
|
||||
SnapshotInterval *string `example:"5m"`
|
||||
// URL to the templates that will be displayed in the UI when navigating to App Templates
|
||||
TemplatesURL *string `example:"https://raw.githubusercontent.com/portainer/templates/master/templates.json"`
|
||||
|
|
|
@ -22,7 +22,7 @@ type composeStackFromFileContentPayload struct {
|
|||
Name string `example:"myStack" validate:"required"`
|
||||
// Content of the Stack file
|
||||
StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx" validate:"required"`
|
||||
// A list of environment variables used during stack deployment
|
||||
// A list of environment(endpoint) variables used during stack deployment
|
||||
Env []portainer.Pair `example:""`
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ type composeStackFromGitRepositoryPayload struct {
|
|||
AdditionalFiles []string `example:"[nz.compose.yml, uat.compose.yml]"`
|
||||
// Optional auto update configuration
|
||||
AutoUpdate *portainer.StackAutoUpdate
|
||||
// A list of environment variables used during stack deployment
|
||||
// A list of environment(endpoint) variables used during stack deployment
|
||||
Env []portainer.Pair
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ type swarmStackFromFileContentPayload struct {
|
|||
SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w" validate:"required"`
|
||||
// Content of the Stack file
|
||||
StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx" validate:"required"`
|
||||
// A list of environment variables used during stack deployment
|
||||
// A list of environment(endpoint) variables used during stack deployment
|
||||
Env []portainer.Pair
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ type swarmStackFromGitRepositoryPayload struct {
|
|||
Name string `example:"myStack" validate:"required"`
|
||||
// Swarm cluster identifier
|
||||
SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w" validate:"required"`
|
||||
// A list of environment variables used during stack deployment
|
||||
// A list of environment(endpoint) variables used during stack deployment
|
||||
Env []portainer.Pair
|
||||
|
||||
// URL of a Git repository hosting the Stack file
|
||||
|
|
|
@ -32,7 +32,7 @@ func (handler *Handler) cleanUp(stack *portainer.Stack, doCleanUp *bool) error {
|
|||
|
||||
// @id StackCreate
|
||||
// @summary Deploy a new stack
|
||||
// @description Deploy a new stack into a Docker environment specified via the endpoint identifier.
|
||||
// @description Deploy a new stack into a Docker environment(endpoint) specified via the environment(endpoint) identifier.
|
||||
// @description **Access policy**: restricted
|
||||
// @tags stacks
|
||||
// @security jwt
|
||||
|
@ -40,14 +40,14 @@ func (handler *Handler) cleanUp(stack *portainer.Stack, doCleanUp *bool) error {
|
|||
// @produce json
|
||||
// @param type query int true "Stack deployment type. Possible values: 1 (Swarm stack) or 2 (Compose stack)." Enums(1,2)
|
||||
// @param method query string true "Stack deployment method. Possible values: file, string or repository." Enums(string, file, repository)
|
||||
// @param endpointId query int true "Identifier of the endpoint that will be used to deploy the stack"
|
||||
// @param endpointId query int true "Identifier of the environment(endpoint) that will be used to deploy the stack"
|
||||
// @param body_swarm_string body swarmStackFromFileContentPayload false "Required when using method=string and type=1"
|
||||
// @param body_swarm_repository body swarmStackFromGitRepositoryPayload false "Required when using method=repository and type=1"
|
||||
// @param body_compose_string body composeStackFromFileContentPayload false "Required when using method=string and type=2"
|
||||
// @param body_compose_repository body composeStackFromGitRepositoryPayload false "Required when using method=repository and type=2"
|
||||
// @param Name formData string false "Name of the stack. required when method is file"
|
||||
// @param SwarmID formData string false "Swarm cluster identifier. Required when method equals file and type equals 1. required when method is file"
|
||||
// @param Env formData string false "Environment variables passed during deployment, represented as a JSON array [{'name': 'name', 'value': 'value'}]. Optional, used when method equals file and type equals 1."
|
||||
// @param Env formData string false "Environment(Endpoint) variables passed during deployment, represented as a JSON array [{'name': 'name', 'value': 'value'}]. Optional, used when method equals file and type equals 1."
|
||||
// @param file formData file false "Stack file. required when method is file"
|
||||
// @success 200 {object} portainer.CustomTemplate
|
||||
// @failure 400 "Invalid request"
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
// @security jwt
|
||||
// @param id path int true "Stack identifier"
|
||||
// @param external query boolean false "Set to true to delete an external stack. Only external Swarm stacks are supported"
|
||||
// @param endpointId query int false "Endpoint identifier used to remove an external stack (required when external is set to true)"
|
||||
// @param endpointId query int false "Environment(Endpoint) identifier used to remove an external stack (required when external is set to true)"
|
||||
// @success 204 "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
// @failure 403 "Permission denied"
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
type stackMigratePayload struct {
|
||||
// Endpoint identifier of the target endpoint where the stack will be relocated
|
||||
// Environment(Endpoint) identifier of the target environment(endpoint) where the stack will be relocated
|
||||
EndpointID int `example:"2" validate:"required"`
|
||||
// Swarm cluster identifier, must match the identifier of the cluster where the stack will be relocated
|
||||
SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w"`
|
||||
|
@ -32,14 +32,14 @@ func (payload *stackMigratePayload) Validate(r *http.Request) error {
|
|||
}
|
||||
|
||||
// @id StackMigrate
|
||||
// @summary Migrate a stack to another endpoint
|
||||
// @description Migrate a stack from an endpoint to another endpoint. It will re-create the stack inside the target endpoint before removing the original stack.
|
||||
// @summary Migrate a stack to another environment(endpoint)
|
||||
// @description Migrate a stack from an environment(endpoint) to another environment(endpoint). It will re-create the stack inside the target environment(endpoint) before removing the original stack.
|
||||
// @description **Access policy**: restricted
|
||||
// @tags stacks
|
||||
// @security jwt
|
||||
// @produce json
|
||||
// @param id path int true "Stack identifier"
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack."
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack."
|
||||
// @param body body stackMigratePayload true "Stack migration details"
|
||||
// @success 200 {object} portainer.Stack "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
|
@ -99,8 +99,8 @@ func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *ht
|
|||
}
|
||||
|
||||
// TODO: this is a work-around for stacks created with Portainer version >= 1.17.1
|
||||
// The EndpointID property is not available for these stacks, this API endpoint
|
||||
// can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack.
|
||||
// The EndpointID property is not available for these stacks, this API environment(endpoint)
|
||||
// can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack.
|
||||
endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true)
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{http.StatusBadRequest, "Invalid query parameter: endpointId", err}
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
type updateComposeStackPayload struct {
|
||||
// New content of the Stack file
|
||||
StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx"`
|
||||
// A list of environment variables used during stack deployment
|
||||
// A list of environment(endpoint) variables used during stack deployment
|
||||
Env []portainer.Pair
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ func (payload *updateComposeStackPayload) Validate(r *http.Request) error {
|
|||
type updateSwarmStackPayload struct {
|
||||
// New content of the Stack file
|
||||
StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx"`
|
||||
// A list of environment variables used during stack deployment
|
||||
// A list of environment(endpoint) variables used during stack deployment
|
||||
Env []portainer.Pair
|
||||
// Prune services that are no longer referenced (only available for Swarm stacks)
|
||||
Prune bool `example:"true"`
|
||||
|
@ -57,7 +57,7 @@ func (payload *updateSwarmStackPayload) Validate(r *http.Request) error {
|
|||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Stack identifier"
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack."
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack."
|
||||
// @param body body updateSwarmStackPayload true "Stack details"
|
||||
// @success 200 {object} portainer.Stack "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
|
@ -79,8 +79,8 @@ func (handler *Handler) stackUpdate(w http.ResponseWriter, r *http.Request) *htt
|
|||
}
|
||||
|
||||
// TODO: this is a work-around for stacks created with Portainer version >= 1.17.1
|
||||
// The EndpointID property is not available for these stacks, this API endpoint
|
||||
// can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack.
|
||||
// The EndpointID property is not available for these stacks, this API environment(endpoint)
|
||||
// can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack.
|
||||
endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true)
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid query parameter: endpointId", Err: err}
|
||||
|
|
|
@ -45,7 +45,7 @@ func (payload *stackGitUpdatePayload) Validate(r *http.Request) error {
|
|||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Stack identifier"
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack."
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack."
|
||||
// @param body body stackGitUpdatePayload true "Git configs for pull and redeploy a stack"
|
||||
// @success 200 {object} portainer.Stack "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
|
@ -76,8 +76,8 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *
|
|||
}
|
||||
|
||||
// TODO: this is a work-around for stacks created with Portainer version >= 1.17.1
|
||||
// The EndpointID property is not available for these stacks, this API endpoint
|
||||
// can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack.
|
||||
// The EndpointID property is not available for these stacks, this API environment(endpoint)
|
||||
// can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack.
|
||||
endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true)
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid query parameter: endpointId", Err: err}
|
||||
|
|
|
@ -46,7 +46,7 @@ func (payload *stackGitRedployPayload) Validate(r *http.Request) error {
|
|||
// @accept json
|
||||
// @produce json
|
||||
// @param id path int true "Stack identifier"
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack."
|
||||
// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack."
|
||||
// @param body body stackGitRedployPayload true "Git configs for pull and redeploy a stack"
|
||||
// @success 200 {object} portainer.Stack "Success"
|
||||
// @failure 400 "Invalid request"
|
||||
|
@ -72,8 +72,8 @@ func (handler *Handler) stackGitRedeploy(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
|
||||
// TODO: this is a work-around for stacks created with Portainer version >= 1.17.1
|
||||
// The EndpointID property is not available for these stacks, this API endpoint
|
||||
// can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack.
|
||||
// The EndpointID property is not available for these stacks, this API environment(endpoint)
|
||||
// can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack.
|
||||
endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true)
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid query parameter: endpointId", Err: err}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
// @id UploadTLS
|
||||
// @summary Upload TLS files
|
||||
// @description Use this endpoint to upload TLS files.
|
||||
// @description Use this environment(endpoint) to upload TLS files.
|
||||
// @description **Access policy**: administrator
|
||||
// @tags upload
|
||||
// @security jwt
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
// @summary Attach a websocket
|
||||
// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent endpoint.
|
||||
// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent environment(endpoint).
|
||||
// @description If the nodeName query parameter is not specified, the request will be upgraded to the websocket protocol and
|
||||
// @description an AttachStart operation HTTP request will be created and hijacked.
|
||||
// @description Authentication and access is controlled via the mandatory token query parameter.
|
||||
|
@ -23,9 +23,9 @@ import (
|
|||
// @tags websocket
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param endpointId query int true "endpoint ID of the endpoint where the resource is located"
|
||||
// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located"
|
||||
// @param nodeName query string false "node name"
|
||||
// @param token query string true "JWT token used for authentication against this endpoint"
|
||||
// @param token query string true "JWT token used for authentication against this environment(endpoint)"
|
||||
// @success 200
|
||||
// @failure 400
|
||||
// @failure 403
|
||||
|
|
|
@ -23,7 +23,7 @@ type execStartOperationPayload struct {
|
|||
}
|
||||
|
||||
// @summary Execute a websocket
|
||||
// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent endpoint.
|
||||
// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent environment(endpoint).
|
||||
// @description If the nodeName query parameter is not specified, the request will be upgraded to the websocket protocol and
|
||||
// @description an ExecStart operation HTTP request will be created and hijacked.
|
||||
// @description Authentication and access is controlled via the mandatory token query parameter.
|
||||
|
@ -31,9 +31,9 @@ type execStartOperationPayload struct {
|
|||
// @tags websocket
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param endpointId query int true "endpoint ID of the endpoint where the resource is located"
|
||||
// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located"
|
||||
// @param nodeName query string false "node name"
|
||||
// @param token query string true "JWT token used for authentication against this endpoint"
|
||||
// @param token query string true "JWT token used for authentication against this environment(endpoint)"
|
||||
// @success 200
|
||||
// @failure 400
|
||||
// @failure 409
|
||||
|
|
|
@ -24,12 +24,12 @@ import (
|
|||
// @tags websocket
|
||||
// @accept json
|
||||
// @produce json
|
||||
// @param endpointId query int true "endpoint ID of the endpoint where the resource is located"
|
||||
// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located"
|
||||
// @param namespace query string true "namespace where the container is located"
|
||||
// @param podName query string true "name of the pod containing the container"
|
||||
// @param containerName query string true "name of the container"
|
||||
// @param command query string true "command to execute in the container"
|
||||
// @param token query string true "JWT token used for authentication against this endpoint"
|
||||
// @param token query string true "JWT token used for authentication against this environment(endpoint)"
|
||||
// @success 200
|
||||
// @failure 400
|
||||
// @failure 403
|
||||
|
|
|
@ -15,8 +15,8 @@ import (
|
|||
// Authentication and access is controlled via the mandatory token query parameter.
|
||||
// The request will proxy input from the client to the pod via long-lived websocket connection.
|
||||
// The following query parameters are mandatory:
|
||||
// * token: JWT token used for authentication against this endpoint
|
||||
// * endpointId: endpoint ID of the endpoint where the resource is located
|
||||
// * token: JWT token used for authentication against this environment(endpoint)
|
||||
// * endpointId: environment(endpoint) ID of the environment(endpoint) where the resource is located
|
||||
func (handler *Handler) websocketShellPodExec(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", false)
|
||||
if err != nil {
|
||||
|
|
|
@ -51,7 +51,7 @@ func (factory *ProxyFactory) NewLegacyExtensionProxy(extensionAPIURL string) (ht
|
|||
return proxy, nil
|
||||
}
|
||||
|
||||
// NewEndpointProxy returns a new reverse proxy (filesystem based or HTTP) to an endpoint API server
|
||||
// NewEndpointProxy returns a new reverse proxy (filesystem based or HTTP) to an environment(endpoint) API server
|
||||
func (factory *ProxyFactory) NewEndpointProxy(endpoint *portainer.Endpoint) (http.Handler, error) {
|
||||
switch endpoint.Type {
|
||||
case portainer.AzureEnvironment:
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
// TODO: contain code related to legacy extension management
|
||||
|
||||
type (
|
||||
// Manager represents a service used to manage proxies to endpoints and extensions.
|
||||
// Manager represents a service used to manage proxies to environments(endpoints) and extensions.
|
||||
Manager struct {
|
||||
proxyFactory *factory.ProxyFactory
|
||||
endpointProxies cmap.ConcurrentMap
|
||||
|
@ -36,7 +36,7 @@ func NewManager(dataStore portainer.DataStore, signatureService portainer.Digita
|
|||
}
|
||||
}
|
||||
|
||||
// CreateAndRegisterEndpointProxy creates a new HTTP reverse proxy based on endpoint properties and and adds it to the registered proxies.
|
||||
// CreateAndRegisterEndpointProxy creates a new HTTP reverse proxy based on environment(endpoint) properties and and adds it to the registered proxies.
|
||||
// It can also be used to create a new HTTP reverse proxy and replace an already registered proxy.
|
||||
func (manager *Manager) CreateAndRegisterEndpointProxy(endpoint *portainer.Endpoint) (http.Handler, error) {
|
||||
proxy, err := manager.proxyFactory.NewEndpointProxy(endpoint)
|
||||
|
@ -48,7 +48,7 @@ func (manager *Manager) CreateAndRegisterEndpointProxy(endpoint *portainer.Endpo
|
|||
return proxy, nil
|
||||
}
|
||||
|
||||
// CreateComposeProxyServer creates a new HTTP reverse proxy based on endpoint properties and and adds it to the registered proxies.
|
||||
// CreateComposeProxyServer creates a new HTTP reverse proxy based on environment(endpoint) properties and and adds it to the registered proxies.
|
||||
// It can also be used to create a new HTTP reverse proxy and replace an already registered proxy.
|
||||
func (manager *Manager) CreateComposeProxyServer(endpoint *portainer.Endpoint) (*factory.ProxyServer, error) {
|
||||
return manager.proxyFactory.NewDockerComposeAgentProxy(endpoint)
|
||||
|
@ -65,7 +65,7 @@ func (manager *Manager) GetEndpointProxy(endpoint *portainer.Endpoint) http.Hand
|
|||
}
|
||||
|
||||
// DeleteEndpointProxy deletes the proxy associated to a key
|
||||
// and cleans the k8s endpoint client cache. DeleteEndpointProxy
|
||||
// and cleans the k8s environment(endpoint) client cache. DeleteEndpointProxy
|
||||
// is currently only called for edge connection clean up.
|
||||
func (manager *Manager) DeleteEndpointProxy(endpoint *portainer.Endpoint) {
|
||||
manager.endpointProxies.Remove(fmt.Sprint(endpoint.ID))
|
||||
|
|
|
@ -103,9 +103,9 @@ func AuthorizedTeamManagement(teamID portainer.TeamID, context *RestrictedReques
|
|||
return false
|
||||
}
|
||||
|
||||
// authorizedEndpointAccess ensure that the user can access the specified endpoint.
|
||||
// authorizedEndpointAccess ensure that the user can access the specified environment(endpoint).
|
||||
// It will check if the user is part of the authorized users or part of a team that is
|
||||
// listed in the authorized teams of the endpoint and the associated group.
|
||||
// listed in the authorized teams of the environment(endpoint) and the associated group.
|
||||
func authorizedEndpointAccess(endpoint *portainer.Endpoint, endpointGroup *portainer.EndpointGroup, userID portainer.UserID, memberships []portainer.TeamMembership) bool {
|
||||
groupAccess := AuthorizedAccess(userID, memberships, endpointGroup.UserAccessPolicies, endpointGroup.TeamAccessPolicies)
|
||||
if !groupAccess {
|
||||
|
@ -114,7 +114,7 @@ func authorizedEndpointAccess(endpoint *portainer.Endpoint, endpointGroup *porta
|
|||
return true
|
||||
}
|
||||
|
||||
// authorizedEndpointGroupAccess ensure that the user can access the specified endpoint group.
|
||||
// authorizedEndpointGroupAccess ensure that the user can access the specified environment(endpoint) group.
|
||||
// It will check if the user is part of the authorized users or part of a team that is
|
||||
// listed in the authorized teams.
|
||||
func authorizedEndpointGroupAccess(endpointGroup *portainer.EndpointGroup, userID portainer.UserID, memberships []portainer.TeamMembership) bool {
|
||||
|
@ -123,7 +123,7 @@ func authorizedEndpointGroupAccess(endpointGroup *portainer.EndpointGroup, userI
|
|||
|
||||
// AuthorizedRegistryAccess ensure that the user can access the specified registry.
|
||||
// It will check if the user is part of the authorized users or part of a team that is
|
||||
// listed in the authorized teams for a specified endpoint,
|
||||
// listed in the authorized teams for a specified environment(endpoint),
|
||||
func AuthorizedRegistryAccess(registry *portainer.Registry, user *portainer.User, teamMemberships []portainer.TeamMembership, endpointID portainer.EndpointID) bool {
|
||||
if user.Role == portainer.AdministratorRole {
|
||||
return true
|
||||
|
|
|
@ -36,16 +36,16 @@ func NewRequestBouncer(dataStore portainer.DataStore, jwtService portainer.JWTSe
|
|||
}
|
||||
}
|
||||
|
||||
// PublicAccess defines a security check for public API endpoints.
|
||||
// No authentication is required to access these endpoints.
|
||||
// PublicAccess defines a security check for public API environments(endpoints).
|
||||
// No authentication is required to access these environments(endpoints).
|
||||
func (bouncer *RequestBouncer) PublicAccess(h http.Handler) http.Handler {
|
||||
h = mwSecureHeaders(h)
|
||||
return h
|
||||
}
|
||||
|
||||
// AdminAccess defines a security check for API endpoints that require an authorization check.
|
||||
// Authentication is required to access these endpoints.
|
||||
// The administrator role is required to use these endpoints.
|
||||
// AdminAccess defines a security check for API environments(endpoints) that require an authorization check.
|
||||
// Authentication is required to access these environments(endpoints).
|
||||
// The administrator role is required to use these environments(endpoints).
|
||||
// The request context will be enhanced with a RestrictedRequestContext object
|
||||
// that might be used later to inside the API operation for extra authorization validation
|
||||
// and resource filtering.
|
||||
|
@ -56,8 +56,8 @@ func (bouncer *RequestBouncer) AdminAccess(h http.Handler) http.Handler {
|
|||
return h
|
||||
}
|
||||
|
||||
// RestrictedAccess defines a security check for restricted API endpoints.
|
||||
// Authentication is required to access these endpoints.
|
||||
// RestrictedAccess defines a security check for restricted API environments(endpoints).
|
||||
// Authentication is required to access these environments(endpoints).
|
||||
// The request context will be enhanced with a RestrictedRequestContext object
|
||||
// that might be used later to inside the API operation for extra authorization validation
|
||||
// and resource filtering.
|
||||
|
@ -68,8 +68,8 @@ func (bouncer *RequestBouncer) RestrictedAccess(h http.Handler) http.Handler {
|
|||
return h
|
||||
}
|
||||
|
||||
// AuthenticatedAccess defines a security check for restricted API endpoints.
|
||||
// Authentication is required to access these endpoints.
|
||||
// AuthenticatedAccess defines a security check for restricted API environments(endpoints).
|
||||
// Authentication is required to access these environments(endpoints).
|
||||
// The request context will be enhanced with a RestrictedRequestContext object
|
||||
// that might be used later to inside the API operation for extra authorization validation
|
||||
// and resource filtering.
|
||||
|
@ -80,8 +80,8 @@ func (bouncer *RequestBouncer) AuthenticatedAccess(h http.Handler) http.Handler
|
|||
}
|
||||
|
||||
// AuthorizedEndpointOperation retrieves the JWT token from the request context and verifies
|
||||
// that the user can access the specified endpoint.
|
||||
// An error is returned when access to the endpoint is denied or if the user do not have the required
|
||||
// that the user can access the specified environment(endpoint).
|
||||
// An error is returned when access to the environments(endpoints) is denied or if the user do not have the required
|
||||
// authorization to execute the operation.
|
||||
func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
||||
tokenData, err := RetrieveTokenData(r)
|
||||
|
@ -110,7 +110,7 @@ func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endp
|
|||
return nil
|
||||
}
|
||||
|
||||
// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge endpoint
|
||||
// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge environment(endpoint)
|
||||
func (bouncer *RequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
||||
if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment {
|
||||
return errors.New("Invalid environment type")
|
||||
|
@ -138,9 +138,9 @@ func (bouncer *RequestBouncer) mwAuthenticatedUser(h http.Handler) http.Handler
|
|||
}
|
||||
|
||||
// mwCheckPortainerAuthorizations will verify that the user has the required authorization to access
|
||||
// a specific API endpoint.
|
||||
// a specific API environment(endpoint).
|
||||
// If the administratorOnly flag is specified, this will prevent non-admin
|
||||
// users from accessing the endpoint.
|
||||
// users from accessing the environment(endpoint).
|
||||
func (bouncer *RequestBouncer) mwCheckPortainerAuthorizations(next http.Handler, administratorOnly bool) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
tokenData, err := RetrieveTokenData(r)
|
||||
|
|
|
@ -80,8 +80,8 @@ func FilterRegistries(registries []portainer.Registry, user *portainer.User, tea
|
|||
return filteredRegistries
|
||||
}
|
||||
|
||||
// FilterEndpoints filters endpoints based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized endpoints (can be inherited via endoint groups).
|
||||
// FilterEndpoints filters environments(endpoints) based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized environments(endpoints) (can be inherited via endoint groups).
|
||||
func FilterEndpoints(endpoints []portainer.Endpoint, groups []portainer.EndpointGroup, context *RestrictedRequestContext) []portainer.Endpoint {
|
||||
filteredEndpoints := endpoints
|
||||
|
||||
|
@ -100,8 +100,8 @@ func FilterEndpoints(endpoints []portainer.Endpoint, groups []portainer.Endpoint
|
|||
return filteredEndpoints
|
||||
}
|
||||
|
||||
// FilterEndpointGroups filters endpoint groups based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized endpoint groups.
|
||||
// FilterEndpointGroups filters environment(endpoint) groups based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized environment(endpoint) groups.
|
||||
func FilterEndpointGroups(endpointGroups []portainer.EndpointGroup, context *RestrictedRequestContext) []portainer.EndpointGroup {
|
||||
filteredEndpointGroups := endpointGroups
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue