feat(ui):rename endpoint(s) to environment(s) EE-1206 (#5588)

* rename endpoints to environments EE-1206
pull/5594/head
Richard Wei 2021-09-08 20:42:17 +12:00 committed by GitHub
parent 1543ad4c42
commit 9f179fe3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
151 changed files with 474 additions and 474 deletions

View File

@ -80,7 +80,7 @@ func (store *Store) Init() error {
if len(groups) == 0 { if len(groups) == 0 {
unassignedGroup := &portainer.EndpointGroup{ unassignedGroup := &portainer.EndpointGroup{
Name: "Unassigned", Name: "Unassigned",
Description: "Unassigned endpoints", Description: "Unassigned environments",
Labels: []portainer.Pair{}, Labels: []portainer.Pair{},
UserAccessPolicies: portainer.UserAccessPolicies{}, UserAccessPolicies: portainer.UserAccessPolicies{},
TeamAccessPolicies: portainer.TeamAccessPolicies{}, TeamAccessPolicies: portainer.TeamAccessPolicies{},

View File

@ -138,7 +138,7 @@ func (m *Migrator) updateDockerhubToDB32() error {
func (m *Migrator) updateVolumeResourceControlToDB32() error { func (m *Migrator) updateVolumeResourceControlToDB32() error {
endpoints, err := m.endpointService.Endpoints() endpoints, err := m.endpointService.Endpoints()
if err != nil { if err != nil {
return fmt.Errorf("failed fetching endpoints: %w", err) return fmt.Errorf("failed fetching environments: %w", err)
} }
resourceControls, err := m.resourceControlService.ResourceControls() resourceControls, err := m.resourceControlService.ResourceControls()
@ -170,7 +170,7 @@ func (m *Migrator) updateVolumeResourceControlToDB32() error {
endpointDockerID, err := snapshotutils.FetchDockerID(snapshot) endpointDockerID, err := snapshotutils.FetchDockerID(snapshot)
if err != nil { if err != nil {
return fmt.Errorf("failed fetching endpoint docker id: %w", err) return fmt.Errorf("failed fetching environment docker id: %w", err)
} }
if volumesData, done := snapshot.SnapshotRaw.Volumes.(map[string]interface{}); done { if volumesData, done := snapshot.SnapshotRaw.Volumes.(map[string]interface{}); done {

View File

@ -141,7 +141,7 @@ func (service *Service) checkTunnels() {
} }
elapsed := time.Since(tunnel.LastActivity) elapsed := time.Since(tunnel.LastActivity)
log.Printf("[DEBUG] [chisel,monitoring] [endpoint_id: %s] [status: %s] [status_time_seconds: %f] [message: endpoint tunnel monitoring]", item.Key, tunnel.Status, elapsed.Seconds()) log.Printf("[DEBUG] [chisel,monitoring] [endpoint_id: %s] [status: %s] [status_time_seconds: %f] [message: environment tunnel monitoring]", item.Key, tunnel.Status, elapsed.Seconds())
if tunnel.Status == portainer.EdgeAgentManagementRequired && elapsed.Seconds() < requiredTimeout.Seconds() { if tunnel.Status == portainer.EdgeAgentManagementRequired && elapsed.Seconds() < requiredTimeout.Seconds() {
continue continue
@ -156,19 +156,19 @@ func (service *Service) checkTunnels() {
endpointID, err := strconv.Atoi(item.Key) endpointID, err := strconv.Atoi(item.Key)
if err != nil { if err != nil {
log.Printf("[ERROR] [chisel,snapshot,conversion] Invalid endpoint identifier (id: %s): %s", item.Key, err) log.Printf("[ERROR] [chisel,snapshot,conversion] Invalid environment identifier (id: %s): %s", item.Key, err)
} }
err = service.snapshotEnvironment(portainer.EndpointID(endpointID), tunnel.Port) err = service.snapshotEnvironment(portainer.EndpointID(endpointID), tunnel.Port)
if err != nil { if err != nil {
log.Printf("[ERROR] [snapshot] Unable to snapshot Edge endpoint (id: %s): %s", item.Key, err) log.Printf("[ERROR] [snapshot] Unable to snapshot Edge environment (id: %s): %s", item.Key, err)
} }
} }
if len(tunnel.Jobs) > 0 { if len(tunnel.Jobs) > 0 {
endpointID, err := strconv.Atoi(item.Key) endpointID, err := strconv.Atoi(item.Key)
if err != nil { if err != nil {
log.Printf("[ERROR] [chisel,conversion] Invalid endpoint identifier (id: %s): %s", item.Key, err) log.Printf("[ERROR] [chisel,conversion] Invalid environment identifier (id: %s): %s", item.Key, err)
continue continue
} }

View File

@ -18,7 +18,7 @@ import (
type Service struct{} type Service struct{}
var ( var (
errInvalidEndpointProtocol = errors.New("Invalid endpoint protocol: Portainer only supports unix://, npipe:// or tcp://") errInvalidEndpointProtocol = errors.New("Invalid environment protocol: Portainer only supports unix://, npipe:// or tcp://")
errSocketOrNamedPipeNotFound = errors.New("Unable to locate Unix socket or named pipe") errSocketOrNamedPipeNotFound = errors.New("Unable to locate Unix socket or named pipe")
errInvalidSnapshotInterval = errors.New("Invalid snapshot interval") errInvalidSnapshotInterval = errors.New("Invalid snapshot interval")
errAdminPassExcludeAdminPassFile = errors.New("Cannot use --admin-password with --admin-password-file") errAdminPassExcludeAdminPassFile = errors.New("Cannot use --admin-password with --admin-password-file")
@ -35,7 +35,7 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
TunnelPort: kingpin.Flag("tunnel-port", "Port to serve the tunnel server").Default(defaultTunnelServerPort).String(), TunnelPort: kingpin.Flag("tunnel-port", "Port to serve the tunnel server").Default(defaultTunnelServerPort).String(),
Assets: kingpin.Flag("assets", "Path to the assets").Default(defaultAssetsDirectory).Short('a').String(), Assets: kingpin.Flag("assets", "Path to the assets").Default(defaultAssetsDirectory).Short('a').String(),
Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(), Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(),
EndpointURL: kingpin.Flag("host", "Endpoint URL").Short('H').String(), EndpointURL: kingpin.Flag("host", "Environment URL").Short('H').String(),
EnableEdgeComputeFeatures: kingpin.Flag("edge-compute", "Enable Edge Compute features").Bool(), EnableEdgeComputeFeatures: kingpin.Flag("edge-compute", "Enable Edge Compute features").Bool(),
NoAnalytics: kingpin.Flag("no-analytics", "Disable Analytics in app (deprecated)").Bool(), NoAnalytics: kingpin.Flag("no-analytics", "Disable Analytics in app (deprecated)").Bool(),
TLS: kingpin.Flag("tlsverify", "TLS support").Default(defaultTLS).Bool(), TLS: kingpin.Flag("tlsverify", "TLS support").Default(defaultTLS).Bool(),
@ -47,7 +47,7 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
SSL: kingpin.Flag("ssl", "Secure Portainer instance using SSL (deprecated)").Default(defaultSSL).Bool(), SSL: kingpin.Flag("ssl", "Secure Portainer instance using SSL (deprecated)").Default(defaultSSL).Bool(),
SSLCert: kingpin.Flag("sslcert", "Path to the SSL certificate used to secure the Portainer instance").String(), SSLCert: kingpin.Flag("sslcert", "Path to the SSL certificate used to secure the Portainer instance").String(),
SSLKey: kingpin.Flag("sslkey", "Path to the SSL key used to secure the Portainer instance").String(), SSLKey: kingpin.Flag("sslkey", "Path to the SSL key used to secure the Portainer instance").String(),
SnapshotInterval: kingpin.Flag("snapshot-interval", "Duration between each endpoint snapshot job").Default(defaultSnapshotInterval).String(), SnapshotInterval: kingpin.Flag("snapshot-interval", "Duration between each environment snapshot job").Default(defaultSnapshotInterval).String(),
AdminPassword: kingpin.Flag("admin-password", "Hashed admin password").String(), AdminPassword: kingpin.Flag("admin-password", "Hashed admin password").String(),
AdminPasswordFile: kingpin.Flag("admin-password-file", "Path to the file containing the password for the admin user").String(), AdminPasswordFile: kingpin.Flag("admin-password-file", "Path to the file containing the password for the admin user").String(),
Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')), Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')),

View File

@ -316,7 +316,7 @@ func createTLSSecuredEndpoint(flags *portainer.CLIFlags, dataStore portainer.Dat
err := snapshotService.SnapshotEndpoint(endpoint) err := snapshotService.SnapshotEndpoint(endpoint)
if err != nil { if err != nil {
log.Printf("http error: endpoint snapshot error (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err) log.Printf("http error: environment snapshot error (environment=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err)
} }
return dataStore.Endpoint().CreateEndpoint(endpoint) return dataStore.Endpoint().CreateEndpoint(endpoint)
@ -362,7 +362,7 @@ func createUnsecuredEndpoint(endpointURL string, dataStore portainer.DataStore,
err := snapshotService.SnapshotEndpoint(endpoint) err := snapshotService.SnapshotEndpoint(endpoint)
if err != nil { if err != nil {
log.Printf("http error: endpoint snapshot error (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err) log.Printf("http error: environment snapshot error (environment=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err)
} }
return dataStore.Endpoint().CreateEndpoint(endpoint) return dataStore.Endpoint().CreateEndpoint(endpoint)
@ -379,7 +379,7 @@ func initEndpoint(flags *portainer.CLIFlags, dataStore portainer.DataStore, snap
} }
if len(endpoints) > 0 { if len(endpoints) > 0 {
log.Println("Instance already has defined endpoints. Skipping the endpoint defined via CLI.") log.Println("Instance already has defined environments. Skipping the environment defined via CLI.")
return nil return nil
} }
@ -474,7 +474,7 @@ func buildServer(flags *portainer.CLIFlags) portainer.Server {
err = initEndpoint(flags, dataStore, snapshotService) err = initEndpoint(flags, dataStore, snapshotService)
if err != nil { if err != nil {
log.Fatalf("failed initializing endpoint: %v", err) log.Fatalf("failed initializing environment: %v", err)
} }
adminPasswordHash := "" adminPasswordHash := ""

View File

@ -4,5 +4,5 @@ import "errors"
// Docker errors // Docker errors
var ( var (
ErrUnableToPingEndpoint = errors.New("Unable to communicate with the endpoint") ErrUnableToPingEndpoint = errors.New("Unable to communicate with the environment")
) )

View File

@ -47,44 +47,44 @@ func snapshot(cli *client.Client, endpoint *portainer.Endpoint) (*portainer.Dock
err = snapshotInfo(snapshot, cli) err = snapshotInfo(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot engine information] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot engine information] [environment: %s] [err: %s]", endpoint.Name, err)
} }
if snapshot.Swarm { if snapshot.Swarm {
err = snapshotSwarmServices(snapshot, cli) err = snapshotSwarmServices(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot Swarm services] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot Swarm services] [environment: %s] [err: %s]", endpoint.Name, err)
} }
err = snapshotNodes(snapshot, cli) err = snapshotNodes(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot Swarm nodes] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot Swarm nodes] [environment: %s] [err: %s]", endpoint.Name, err)
} }
} }
err = snapshotContainers(snapshot, cli) err = snapshotContainers(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot containers] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot containers] [environment: %s] [err: %s]", endpoint.Name, err)
} }
err = snapshotImages(snapshot, cli) err = snapshotImages(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot images] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot images] [environment: %s] [err: %s]", endpoint.Name, err)
} }
err = snapshotVolumes(snapshot, cli) err = snapshotVolumes(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot volumes] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot volumes] [environment: %s] [err: %s]", endpoint.Name, err)
} }
err = snapshotNetworks(snapshot, cli) err = snapshotNetworks(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot networks] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot networks] [environment: %s] [err: %s]", endpoint.Name, err)
} }
err = snapshotVersion(snapshot, cli) err = snapshotVersion(snapshot, cli)
if err != nil { if err != nil {
log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot engine version] [endpoint: %s] [err: %s]", endpoint.Name, err) log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot engine version] [environment: %s] [err: %s]", endpoint.Name, err)
} }
snapshot.Time = time.Now().Unix() snapshot.Time = time.Now().Unix()

View File

@ -46,7 +46,7 @@ func (manager *ComposeStackManager) ComposeSyntaxMaxVersion() string {
func (manager *ComposeStackManager) Up(ctx context.Context, stack *portainer.Stack, endpoint *portainer.Endpoint) error { func (manager *ComposeStackManager) Up(ctx context.Context, stack *portainer.Stack, endpoint *portainer.Endpoint) error {
url, proxy, err := manager.fetchEndpointProxy(endpoint) url, proxy, err := manager.fetchEndpointProxy(endpoint)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to featch endpoint proxy") return errors.Wrap(err, "failed to featch environment proxy")
} }
if proxy != nil { if proxy != nil {

View File

@ -4,7 +4,7 @@ import "errors"
var ( var (
// ErrEndpointAccessDenied Access denied to endpoint error // ErrEndpointAccessDenied Access denied to endpoint error
ErrEndpointAccessDenied = errors.New("Access denied to endpoint") ErrEndpointAccessDenied = errors.New("Access denied to environment")
// ErrUnauthorized Unauthorized error // ErrUnauthorized Unauthorized error
ErrUnauthorized = errors.New("Unauthorized") ErrUnauthorized = errors.New("Unauthorized")
// ErrResourceAccessDenied Access denied to resource error // ErrResourceAccessDenied Access denied to resource error

View File

@ -27,7 +27,7 @@ func (payload *edgeGroupCreatePayload) Validate(r *http.Request) error {
return errors.New("TagIDs is mandatory for a dynamic Edge group") return errors.New("TagIDs is mandatory for a dynamic Edge group")
} }
if !payload.Dynamic && (payload.Endpoints == nil || len(payload.Endpoints) == 0) { if !payload.Dynamic && (payload.Endpoints == nil || len(payload.Endpoints) == 0) {
return errors.New("Endpoints is mandatory for a static Edge group") return errors.New("Environment is mandatory for a static Edge group")
} }
return nil return nil
} }
@ -77,7 +77,7 @@ func (handler *Handler) edgeGroupCreate(w http.ResponseWriter, r *http.Request)
for _, endpointID := range payload.Endpoints { for _, endpointID := range payload.Endpoints {
endpoint, err := handler.DataStore.Endpoint().Endpoint(endpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment from the database", err}
} }
if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment { if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment {

View File

@ -38,7 +38,7 @@ func (handler *Handler) edgeGroupInspect(w http.ResponseWriter, r *http.Request)
if edgeGroup.Dynamic { if edgeGroup.Dynamic {
endpoints, err := handler.getEndpointsByTags(edgeGroup.TagIDs, edgeGroup.PartialMatch) endpoints, err := handler.getEndpointsByTags(edgeGroup.TagIDs, edgeGroup.PartialMatch)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints and endpoint groups for Edge group", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments and environment groups for Edge group", err}
} }
edgeGroup.Endpoints = endpoints edgeGroup.Endpoints = endpoints

View File

@ -51,7 +51,7 @@ func (handler *Handler) edgeGroupList(w http.ResponseWriter, r *http.Request) *h
if edgeGroup.Dynamic { if edgeGroup.Dynamic {
endpoints, err := handler.getEndpointsByTags(edgeGroup.TagIDs, edgeGroup.PartialMatch) endpoints, err := handler.getEndpointsByTags(edgeGroup.TagIDs, edgeGroup.PartialMatch)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints and endpoint groups for Edge group", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments and environment groups for Edge group", err}
} }
edgeGroup.Endpoints = endpoints edgeGroup.Endpoints = endpoints

View File

@ -29,7 +29,7 @@ func (payload *edgeGroupUpdatePayload) Validate(r *http.Request) error {
return errors.New("TagIDs is mandatory for a dynamic Edge group") return errors.New("TagIDs is mandatory for a dynamic Edge group")
} }
if !payload.Dynamic && (payload.Endpoints == nil || len(payload.Endpoints) == 0) { if !payload.Dynamic && (payload.Endpoints == nil || len(payload.Endpoints) == 0) {
return errors.New("Endpoints is mandatory for a static Edge group") return errors.New("Environments is mandatory for a static Edge group")
} }
return nil return nil
} }
@ -81,12 +81,12 @@ func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request)
} }
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from database", err}
} }
endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups() endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint groups from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment groups from database", err}
} }
oldRelatedEndpoints := edge.EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups) oldRelatedEndpoints := edge.EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups)
@ -99,7 +99,7 @@ func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request)
for _, endpointID := range payload.Endpoints { for _, endpointID := range payload.Endpoints {
endpoint, err := handler.DataStore.Endpoint().Endpoint(endpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment from the database", err}
} }
if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment { if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment {
@ -124,7 +124,7 @@ func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request)
for _, endpointID := range endpointsToUpdate { for _, endpointID := range endpointsToUpdate {
err = handler.updateEndpoint(endpointID) err = handler.updateEndpoint(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist Endpoint relation changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist Environment relation changes inside the database", err}
} }
} }

View File

@ -66,7 +66,7 @@ func (payload *edgeJobCreateFromFileContentPayload) Validate(r *http.Request) er
} }
if payload.Endpoints == nil || len(payload.Endpoints) == 0 { if payload.Endpoints == nil || len(payload.Endpoints) == 0 {
return errors.New("Invalid endpoints payload") return errors.New("Invalid environment payload")
} }
if govalidator.IsNull(payload.FileContent) { if govalidator.IsNull(payload.FileContent) {
@ -119,9 +119,9 @@ func (payload *edgeJobCreateFromFilePayload) Validate(r *http.Request) error {
payload.CronExpression = cronExpression payload.CronExpression = cronExpression
var endpoints []portainer.EndpointID var endpoints []portainer.EndpointID
err = request.RetrieveMultiPartFormJSONValue(r, "Endpoints", &endpoints, false) err = request.RetrieveMultiPartFormJSONValue(r, "Environments", &endpoints, false)
if err != nil { if err != nil {
return errors.New("Invalid endpoints") return errors.New("Invalid environments")
} }
payload.Endpoints = endpoints payload.Endpoints = endpoints
@ -206,7 +206,7 @@ func (handler *Handler) addAndPersistEdgeJob(edgeJob *portainer.EdgeJob, file []
} }
if len(edgeJob.Endpoints) == 0 { if len(edgeJob.Endpoints) == 0 {
return errors.New("Endpoints are mandatory for an Edge job") return errors.New("Environments are mandatory for an Edge job")
} }
scriptPath, err := handler.FileService.StoreEdgeJobFileFromBytes(strconv.Itoa(int(edgeJob.ID)), file) scriptPath, err := handler.FileService.StoreEdgeJobFileFromBytes(strconv.Itoa(int(edgeJob.ID)), file)

View File

@ -44,12 +44,12 @@ func (handler *Handler) edgeStackCreate(w http.ResponseWriter, r *http.Request)
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from database", err}
} }
endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups() endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint groups from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment groups from database", err}
} }
edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups() edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
@ -62,14 +62,14 @@ func (handler *Handler) edgeStackCreate(w http.ResponseWriter, r *http.Request)
for _, endpointID := range relatedEndpoints { for _, endpointID := range relatedEndpoints {
relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID) relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find environment relation in database", err}
} }
relation.EdgeStacks[edgeStack.ID] = true relation.EdgeStacks[edgeStack.ID] = true
err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation) err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relation in database", err}
} }
} }

View File

@ -44,12 +44,12 @@ func (handler *Handler) edgeStackDelete(w http.ResponseWriter, r *http.Request)
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from database", err}
} }
endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups() endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint groups from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment groups from database", err}
} }
edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups() edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
@ -62,14 +62,14 @@ func (handler *Handler) edgeStackDelete(w http.ResponseWriter, r *http.Request)
for _, endpointID := range relatedEndpoints { for _, endpointID := range relatedEndpoints {
relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID) relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find environment relation in database", err}
} }
delete(relation.EdgeStacks, edgeStack.ID) delete(relation.EdgeStacks, edgeStack.ID)
err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation) err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relation in database", err}
} }
} }

View File

@ -23,7 +23,7 @@ func (payload *updateStatusPayload) Validate(r *http.Request) error {
return errors.New("Invalid status") return errors.New("Invalid status")
} }
if payload.EndpointID == nil { if payload.EndpointID == nil {
return errors.New("Invalid EndpointID") return errors.New("Invalid EnvironmentID")
} }
if *payload.Status == portainer.StatusError && govalidator.IsNull(payload.Error) { if *payload.Status == portainer.StatusError && govalidator.IsNull(payload.Error) {
return errors.New("Error message is mandatory when status is error") return errors.New("Error message is mandatory when status is error")
@ -65,14 +65,14 @@ func (handler *Handler) edgeStackStatusUpdate(w http.ResponseWriter, r *http.Req
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(*payload.EndpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(*payload.EndpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
stack.Status[*payload.EndpointID] = portainer.EdgeStackStatus{ stack.Status[*payload.EndpointID] = portainer.EdgeStackStatus{

View File

@ -67,12 +67,12 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request)
if payload.EdgeGroups != nil { if payload.EdgeGroups != nil {
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from database", err}
} }
endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups() endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint groups from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment groups from database", err}
} }
edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups() edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
@ -82,12 +82,12 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request)
oldRelated, err := edge.EdgeStackRelatedEndpoints(stack.EdgeGroups, endpoints, endpointGroups, edgeGroups) oldRelated, err := edge.EdgeStackRelatedEndpoints(stack.EdgeGroups, endpoints, endpointGroups, edgeGroups)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve edge stack related endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve edge stack related environments from database", err}
} }
newRelated, err := edge.EdgeStackRelatedEndpoints(payload.EdgeGroups, endpoints, endpointGroups, edgeGroups) newRelated, err := edge.EdgeStackRelatedEndpoints(payload.EdgeGroups, endpoints, endpointGroups, edgeGroups)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve edge stack related endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve edge stack related environments from database", err}
} }
oldRelatedSet := EndpointSet(oldRelated) oldRelatedSet := EndpointSet(oldRelated)
@ -103,14 +103,14 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request)
for endpointID := range endpointsToRemove { for endpointID := range endpointsToRemove {
relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID) relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find environment relation in database", err}
} }
delete(relation.EdgeStacks, stack.ID) delete(relation.EdgeStacks, stack.ID)
err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation) err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relation in database", err}
} }
} }
@ -124,14 +124,14 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request)
for endpointID := range endpointsToAdd { for endpointID := range endpointsToAdd {
relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID) relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find environment relation in database", err}
} }
relation.EdgeStacks[stack.ID] = true relation.EdgeStacks[stack.ID] = true
err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation) err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpointID, relation)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relation in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relation in database", err}
} }
} }

View File

@ -34,19 +34,19 @@ func (payload *logsPayload) Validate(r *http.Request) error {
func (handler *Handler) endpointEdgeJobsLogs(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointEdgeJobsLogs(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
edgeJobID, err := request.RetrieveNumericRouteVariableValue(r, "jobID") edgeJobID, err := request.RetrieveNumericRouteVariableValue(r, "jobID")

View File

@ -32,19 +32,19 @@ type configResponse struct {
func (handler *Handler) endpointEdgeStackInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointEdgeStackInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
edgeStackID, err := request.RetrieveNumericRouteVariableValue(r, "stackId") edgeStackID, err := request.RetrieveNumericRouteVariableValue(r, "stackId")

View File

@ -24,7 +24,7 @@ type endpointGroupCreatePayload struct {
func (payload *endpointGroupCreatePayload) Validate(r *http.Request) error { func (payload *endpointGroupCreatePayload) Validate(r *http.Request) error {
if govalidator.IsNull(payload.Name) { if govalidator.IsNull(payload.Name) {
return errors.New("Invalid endpoint group name") return errors.New("Invalid environment group name")
} }
if payload.TagIDs == nil { if payload.TagIDs == nil {
payload.TagIDs = []portainer.TagID{} payload.TagIDs = []portainer.TagID{}
@ -61,12 +61,12 @@ func (handler *Handler) endpointGroupCreate(w http.ResponseWriter, r *http.Reque
err = handler.DataStore.EndpointGroup().CreateEndpointGroup(endpointGroup) err = handler.DataStore.EndpointGroup().CreateEndpointGroup(endpointGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist the endpoint group inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist the environment group inside the database", err}
} }
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from the database", err}
} }
for _, id := range payload.AssociatedEndpoints { for _, id := range payload.AssociatedEndpoints {
@ -76,12 +76,12 @@ func (handler *Handler) endpointGroupCreate(w http.ResponseWriter, r *http.Reque
err := handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, &endpoint) err := handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, &endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update endpoint", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update environment", err}
} }
err = handler.updateEndpointRelations(&endpoint, endpointGroup) err = handler.updateEndpointRelations(&endpoint, endpointGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relations changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relations changes inside the database", err}
} }
break break

View File

@ -28,28 +28,28 @@ import (
func (handler *Handler) endpointGroupDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointGroupDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint group identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment group identifier route variable", err}
} }
if endpointGroupID == 1 { if endpointGroupID == 1 {
return &httperror.HandlerError{http.StatusForbidden, "Unable to remove the default 'Unassigned' group", errors.New("Cannot remove the default endpoint group")} return &httperror.HandlerError{http.StatusForbidden, "Unable to remove the default 'Unassigned' group", errors.New("Cannot remove the default environment group")}
} }
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID)) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment group with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment group with the specified identifier inside the database", err}
} }
err = handler.DataStore.EndpointGroup().DeleteEndpointGroup(portainer.EndpointGroupID(endpointGroupID)) err = handler.DataStore.EndpointGroup().DeleteEndpointGroup(portainer.EndpointGroupID(endpointGroupID))
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove the endpoint group from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove the environment group from the database", err}
} }
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment from the database", err}
} }
for _, endpoint := range endpoints { for _, endpoint := range endpoints {
@ -57,12 +57,12 @@ func (handler *Handler) endpointGroupDelete(w http.ResponseWriter, r *http.Reque
endpoint.GroupID = portainer.EndpointGroupID(1) endpoint.GroupID = portainer.EndpointGroupID(1)
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, &endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, &endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update endpoint", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update environment", err}
} }
err = handler.updateEndpointRelations(&endpoint, nil) err = handler.updateEndpointRelations(&endpoint, nil)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relations changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relations changes inside the database", err}
} }
} }
} }

View File

@ -26,38 +26,38 @@ import (
func (handler *Handler) endpointGroupAddEndpoint(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointGroupAddEndpoint(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint group identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment group identifier route variable", err}
} }
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "endpointId") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "endpointId")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID)) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment group with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment group with the specified identifier inside the database", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
endpoint.GroupID = endpointGroup.ID endpoint.GroupID = endpointGroup.ID
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
err = handler.updateEndpointRelations(endpoint, endpointGroup) err = handler.updateEndpointRelations(endpoint, endpointGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relations changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relations changes inside the database", err}
} }
return response.Empty(w) return response.Empty(w)

View File

@ -25,38 +25,38 @@ import (
func (handler *Handler) endpointGroupDeleteEndpoint(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointGroupDeleteEndpoint(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint group identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment group identifier route variable", err}
} }
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "endpointId") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "endpointId")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
_, err = handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID)) _, err = handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment group with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment group with the specified identifier inside the database", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
endpoint.GroupID = portainer.EndpointGroupID(1) endpoint.GroupID = portainer.EndpointGroupID(1)
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
err = handler.updateEndpointRelations(endpoint, nil) err = handler.updateEndpointRelations(endpoint, nil)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relations changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relations changes inside the database", err}
} }
return response.Empty(w) return response.Empty(w)

View File

@ -26,14 +26,14 @@ import (
func (handler *Handler) endpointGroupInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointGroupInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint group identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment group identifier route variable", err}
} }
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID)) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment group with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment group with the specified identifier inside the database", err}
} }
return response.JSON(w, endpointGroup) return response.JSON(w, endpointGroup)

View File

@ -23,7 +23,7 @@ import (
func (handler *Handler) endpointGroupList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointGroupList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups() endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint groups from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment groups from the database", err}
} }
securityContext, err := security.RetrieveRestrictedRequestContext(r) securityContext, err := security.RetrieveRestrictedRequestContext(r)

View File

@ -45,7 +45,7 @@ func (payload *endpointGroupUpdatePayload) Validate(r *http.Request) error {
func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint group identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment group identifier route variable", err}
} }
var payload endpointGroupUpdatePayload var payload endpointGroupUpdatePayload
@ -56,9 +56,9 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID)) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(endpointGroupID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment group with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint group with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment group with the specified identifier inside the database", err}
} }
if payload.Name != "" { if payload.Name != "" {
@ -123,7 +123,7 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque
if updateAuthorizations { if updateAuthorizations {
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from the database", err}
} }
for _, endpoint := range endpoints { for _, endpoint := range endpoints {
@ -140,13 +140,13 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque
err = handler.DataStore.EndpointGroup().UpdateEndpointGroup(endpointGroup.ID, endpointGroup) err = handler.DataStore.EndpointGroup().UpdateEndpointGroup(endpointGroup.ID, endpointGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint group changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment group changes inside the database", err}
} }
if tagsChanged { if tagsChanged {
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from the database", err}
} }
@ -154,7 +154,7 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque
if endpoint.GroupID == endpointGroup.ID { if endpoint.GroupID == endpointGroup.ID {
err = handler.updateEndpointRelations(&endpoint, endpointGroup) err = handler.updateEndpointRelations(&endpoint, endpointGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relations changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relations changes inside the database", err}
} }
} }
} }

View File

@ -14,19 +14,19 @@ import (
func (handler *Handler) proxyRequestsToAzureAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) proxyRequestsToAzureAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
var proxy http.Handler var proxy http.Handler

View File

@ -17,24 +17,24 @@ import (
func (handler *Handler) proxyRequestsToDockerAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) proxyRequestsToDockerAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment { if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment {
if endpoint.EdgeID == "" { if endpoint.EdgeID == "" {
return &httperror.HandlerError{http.StatusInternalServerError, "No Edge agent registered with the endpoint", errors.New("No agent available")} return &httperror.HandlerError{http.StatusInternalServerError, "No Edge agent registered with the environment", errors.New("No agent available")}
} }
tunnel := handler.ReverseTunnelService.GetTunnelDetails(endpoint.ID) tunnel := handler.ReverseTunnelService.GetTunnelDetails(endpoint.ID)

View File

@ -17,24 +17,24 @@ import (
func (handler *Handler) proxyRequestsToKubernetesAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) proxyRequestsToKubernetesAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment { if endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment {
if endpoint.EdgeID == "" { if endpoint.EdgeID == "" {
return &httperror.HandlerError{http.StatusInternalServerError, "No Edge agent registered with the endpoint", errors.New("No agent available")} return &httperror.HandlerError{http.StatusInternalServerError, "No Edge agent registered with the environment", errors.New("No agent available")}
} }
tunnel := handler.ReverseTunnelService.GetTunnelDetails(endpoint.ID) tunnel := handler.ReverseTunnelService.GetTunnelDetails(endpoint.ID)

View File

@ -17,19 +17,19 @@ import (
func (handler *Handler) proxyRequestsToStoridgeAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) proxyRequestsToStoridgeAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
var storidgeExtension *portainer.EndpointExtension var storidgeExtension *portainer.EndpointExtension
@ -40,7 +40,7 @@ func (handler *Handler) proxyRequestsToStoridgeAPI(w http.ResponseWriter, r *htt
} }
if storidgeExtension == nil { if storidgeExtension == nil {
return &httperror.HandlerError{http.StatusServiceUnavailable, "Storidge extension not supported on this endpoint", errors.New("This extension is not supported")} return &httperror.HandlerError{http.StatusServiceUnavailable, "Storidge extension not supported on this environment", errors.New("This extension is not supported")}
} }
proxyExtensionKey := strconv.Itoa(endpointID) + "_" + strconv.Itoa(int(portainer.StoridgeEndpointExtension)) + "_" + storidgeExtension.URL proxyExtensionKey := strconv.Itoa(endpointID) + "_" + strconv.Itoa(int(portainer.StoridgeEndpointExtension)) + "_" + storidgeExtension.URL

View File

@ -30,18 +30,18 @@ import (
func (handler *Handler) endpointAssociationDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointAssociationDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment { if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint type", errors.New("Invalid endpoint type")} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment type", errors.New("Invalid environment type")}
} }
endpoint.EdgeID = "" endpoint.EdgeID = ""
@ -55,7 +55,7 @@ func (handler *Handler) endpointAssociationDelete(w http.ResponseWriter, r *http
err = handler.DataStore.Endpoint().UpdateEndpoint(portainer.EndpointID(endpointID), endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(portainer.EndpointID(endpointID), endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Failed persisting endpoint in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Failed persisting environment in database", err}
} }
handler.ReverseTunnelService.SetTunnelStatusToIdle(endpoint.ID) handler.ReverseTunnelService.SetTunnelStatusToIdle(endpoint.ID)

View File

@ -53,13 +53,13 @@ const (
func (payload *endpointCreatePayload) Validate(r *http.Request) error { func (payload *endpointCreatePayload) Validate(r *http.Request) error {
name, err := request.RetrieveMultiPartFormValue(r, "Name", false) name, err := request.RetrieveMultiPartFormValue(r, "Name", false)
if err != nil { if err != nil {
return errors.New("Invalid endpoint name") return errors.New("Invalid environment name")
} }
payload.Name = name payload.Name = name
endpointCreationType, err := request.RetrieveNumericMultiPartFormValue(r, "EndpointCreationType", false) endpointCreationType, err := request.RetrieveNumericMultiPartFormValue(r, "EndpointCreationType", false)
if err != nil || endpointCreationType == 0 { if err != nil || endpointCreationType == 0 {
return errors.New("Invalid endpoint type value. Value must be one of: 1 (Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge Agent environment) or 5 (Local Kubernetes environment)") return errors.New("Invalid environment type value. Value must be one of: 1 (Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge Agent environment) or 5 (Local Kubernetes environment)")
} }
payload.EndpointCreationType = endpointCreationEnum(endpointCreationType) payload.EndpointCreationType = endpointCreationEnum(endpointCreationType)
@ -133,7 +133,7 @@ func (payload *endpointCreatePayload) Validate(r *http.Request) error {
default: default:
endpointURL, err := request.RetrieveMultiPartFormValue(r, "URL", true) endpointURL, err := request.RetrieveMultiPartFormValue(r, "URL", true)
if err != nil { if err != nil {
return errors.New("Invalid endpoint URL") return errors.New("Invalid environment URL")
} }
payload.URL = endpointURL payload.URL = endpointURL
@ -189,7 +189,7 @@ func (handler *Handler) endpointCreate(w http.ResponseWriter, r *http.Request) *
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(endpoint.GroupID) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(endpoint.GroupID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint group inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment group inside the database", err}
} }
edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups() edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
@ -238,7 +238,7 @@ func (handler *Handler) createEndpoint(payload *endpointCreatePayload) (*portain
if payload.EndpointCreationType == agentEnvironment { if payload.EndpointCreationType == agentEnvironment {
agentPlatform, err := handler.pingAndCheckPlatform(payload) agentPlatform, err := handler.pingAndCheckPlatform(payload)
if err != nil { if err != nil {
return nil, &httperror.HandlerError{http.StatusInternalServerError, "Unable to get endpoint type", err} return nil, &httperror.HandlerError{http.StatusInternalServerError, "Unable to get environment type", err}
} }
if agentPlatform == portainer.AgentPlatformDocker { if agentPlatform == portainer.AgentPlatformDocker {
@ -288,7 +288,7 @@ func (handler *Handler) createAzureEndpoint(payload *endpointCreatePayload) (*po
err = handler.saveEndpointAndUpdateAuthorizations(endpoint) err = handler.saveEndpointAndUpdateAuthorizations(endpoint)
if err != nil { if err != nil {
return nil, &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the endpoint", err} return nil, &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the environment", err}
} }
return endpoint, nil return endpoint, nil
@ -299,7 +299,7 @@ func (handler *Handler) createEdgeAgentEndpoint(payload *endpointCreatePayload)
portainerURL, err := url.Parse(payload.URL) portainerURL, err := url.Parse(payload.URL)
if err != nil { if err != nil {
return nil, &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint URL", err} return nil, &httperror.HandlerError{http.StatusBadRequest, "Invalid environment URL", err}
} }
portainerHost, _, err := net.SplitHostPort(portainerURL.Host) portainerHost, _, err := net.SplitHostPort(portainerURL.Host)
@ -308,7 +308,7 @@ func (handler *Handler) createEdgeAgentEndpoint(payload *endpointCreatePayload)
} }
if portainerHost == "localhost" { if portainerHost == "localhost" {
return nil, &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint URL", errors.New("cannot use localhost as endpoint URL")} return nil, &httperror.HandlerError{http.StatusBadRequest, "Invalid environment URL", errors.New("cannot use localhost as environment URL")}
} }
edgeKey := handler.ReverseTunnelService.GenerateEdgeKey(payload.URL, portainerHost, endpointID) edgeKey := handler.ReverseTunnelService.GenerateEdgeKey(payload.URL, portainerHost, endpointID)
@ -335,7 +335,7 @@ func (handler *Handler) createEdgeAgentEndpoint(payload *endpointCreatePayload)
err = handler.saveEndpointAndUpdateAuthorizations(endpoint) err = handler.saveEndpointAndUpdateAuthorizations(endpoint)
if err != nil { if err != nil {
return nil, &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the endpoint", err} return nil, &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the environment", err}
} }
return endpoint, nil return endpoint, nil
@ -455,12 +455,12 @@ func (handler *Handler) snapshotAndPersistEndpoint(endpoint *portainer.Endpoint)
if strings.Contains(err.Error(), "Invalid request signature") { if strings.Contains(err.Error(), "Invalid request signature") {
err = errors.New("agent already paired with another Portainer instance") err = errors.New("agent already paired with another Portainer instance")
} }
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to initiate communications with endpoint", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to initiate communications with environment", err}
} }
err = handler.saveEndpointAndUpdateAuthorizations(endpoint) err = handler.saveEndpointAndUpdateAuthorizations(endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the endpoint", err} return &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the environment", err}
} }
return nil return nil

View File

@ -26,14 +26,14 @@ import (
func (handler *Handler) endpointDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if endpoint.TLSConfig.TLS { if endpoint.TLSConfig.TLS {
@ -46,14 +46,14 @@ func (handler *Handler) endpointDelete(w http.ResponseWriter, r *http.Request) *
err = handler.DataStore.Endpoint().DeleteEndpoint(portainer.EndpointID(endpointID)) err = handler.DataStore.Endpoint().DeleteEndpoint(portainer.EndpointID(endpointID))
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove endpoint from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove environment from the database", err}
} }
handler.ProxyManager.DeleteEndpointProxy(endpoint) handler.ProxyManager.DeleteEndpointProxy(endpoint)
err = handler.DataStore.EndpointRelation().DeleteEndpointRelation(endpoint.ID) err = handler.DataStore.EndpointRelation().DeleteEndpointRelation(endpoint.ID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove endpoint relation from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to remove environment relation from the database", err}
} }
for _, tagID := range endpoint.TagIDs { for _, tagID := range endpoint.TagIDs {

View File

@ -26,14 +26,14 @@ type dockerhubStatusResponse struct {
func (handler *Handler) endpointDockerhubStatus(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointDockerhubStatus(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if !endpointutils.IsLocalEndpoint(endpoint) { if !endpointutils.IsLocalEndpoint(endpoint) {

View File

@ -32,14 +32,14 @@ func (payload *endpointExtensionAddPayload) Validate(r *http.Request) error {
func (handler *Handler) endpointExtensionAdd(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointExtensionAdd(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
var payload endpointExtensionAddPayload var payload endpointExtensionAddPayload
@ -69,7 +69,7 @@ func (handler *Handler) endpointExtensionAdd(w http.ResponseWriter, r *http.Requ
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
return response.JSON(w, extension) return response.JSON(w, extension)

View File

@ -15,14 +15,14 @@ import (
func (handler *Handler) endpointExtensionRemove(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointExtensionRemove(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
extensionType, err := request.RetrieveNumericRouteVariableValue(r, "extensionType") extensionType, err := request.RetrieveNumericRouteVariableValue(r, "extensionType")
@ -38,7 +38,7 @@ func (handler *Handler) endpointExtensionRemove(w http.ResponseWriter, r *http.R
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
return response.Empty(w) return response.Empty(w)

View File

@ -26,19 +26,19 @@ import (
func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
hideFields(endpoint) hideFields(endpoint)

View File

@ -60,12 +60,12 @@ func (handler *Handler) endpointList(w http.ResponseWriter, r *http.Request) *ht
endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups() endpointGroups, err := handler.DataStore.EndpointGroup().EndpointGroups()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint groups from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment groups from the database", err}
} }
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from the database", err}
} }
settings, err := handler.DataStore.Settings().Settings() settings, err := handler.DataStore.Settings().Settings()

View File

@ -16,7 +16,7 @@ import (
func (handler *Handler) endpointRegistryInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointRegistryInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid endpoint identifier route variable", Err: err} return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid environment identifier route variable", Err: err}
} }
registryID, err := request.RetrieveNumericRouteVariableValue(r, "registryId") registryID, err := request.RetrieveNumericRouteVariableValue(r, "registryId")

View File

@ -27,14 +27,14 @@ func (handler *Handler) endpointRegistriesList(w http.ResponseWriter, r *http.Re
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid endpoint identifier route variable", Err: err} return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid environment identifier route variable", Err: err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
isAdmin := securityContext.IsAdmin isAdmin := securityContext.IsAdmin
@ -92,7 +92,7 @@ func (handler *Handler) isNamespaceAuthorized(endpoint *portainer.Endpoint, name
accessPolicies, err := kcl.GetNamespaceAccessPolicies() accessPolicies, err := kcl.GetNamespaceAccessPolicies()
if err != nil { if err != nil {
return false, errors.Wrap(err, "unable to retrieve endpoint's namespaces policies") return false, errors.Wrap(err, "unable to retrieve environment's namespaces policies")
} }
namespacePolicy, ok := accessPolicies[namespace] namespacePolicy, ok := accessPolicies[namespace]

View File

@ -25,7 +25,7 @@ func (payload *registryAccessPayload) Validate(r *http.Request) error {
func (handler *Handler) endpointRegistryAccess(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointRegistryAccess(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid endpoint identifier route variable", Err: err} return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid environment identifier route variable", Err: err}
} }
registryID, err := request.RetrieveNumericRouteVariableValue(r, "registryId") registryID, err := request.RetrieveNumericRouteVariableValue(r, "registryId")
@ -35,9 +35,9 @@ func (handler *Handler) endpointRegistryAccess(w http.ResponseWriter, r *http.Re
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find an endpoint with the specified identifier inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find an environment with the specified identifier inside the database", Err: err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find an endpoint with the specified identifier inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find an environment with the specified identifier inside the database", Err: err}
} }
securityContext, err := security.RetrieveRestrictedRequestContext(r) securityContext, err := security.RetrieveRestrictedRequestContext(r)
@ -47,7 +47,7 @@ func (handler *Handler) endpointRegistryAccess(w http.ResponseWriter, r *http.Re
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if !securityContext.IsAdmin { if !securityContext.IsAdmin {
@ -56,9 +56,9 @@ func (handler *Handler) endpointRegistryAccess(w http.ResponseWriter, r *http.Re
registry, err := handler.DataStore.Registry().Registry(portainer.RegistryID(registryID)) registry, err := handler.DataStore.Registry().Registry(portainer.RegistryID(registryID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find an endpoint with the specified identifier inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find an environment with the specified identifier inside the database", Err: err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find an endpoint with the specified identifier inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find an environment with the specified identifier inside the database", Err: err}
} }
var payload registryAccessPayload var payload registryAccessPayload

View File

@ -53,7 +53,7 @@ func (payload *endpointSettingsUpdatePayload) Validate(r *http.Request) error {
func (handler *Handler) endpointSettingsUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointSettingsUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
var payload endpointSettingsUpdatePayload var payload endpointSettingsUpdatePayload
@ -64,9 +64,9 @@ func (handler *Handler) endpointSettingsUpdate(w http.ResponseWriter, r *http.Re
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
securitySettings := endpoint.SecuritySettings securitySettings := endpoint.SecuritySettings
@ -111,7 +111,7 @@ func (handler *Handler) endpointSettingsUpdate(w http.ResponseWriter, r *http.Re
err = handler.DataStore.Endpoint().UpdateEndpoint(portainer.EndpointID(endpointID), endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(portainer.EndpointID(endpointID), endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Failed persisting endpoint in database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Failed persisting environment in database", err}
} }
return response.JSON(w, endpoint) return response.JSON(w, endpoint)

View File

@ -26,25 +26,25 @@ import (
func (handler *Handler) endpointSnapshot(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointSnapshot(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if !snapshot.SupportDirectSnapshot(endpoint) { if !snapshot.SupportDirectSnapshot(endpoint) {
return &httperror.HandlerError{http.StatusBadRequest, "Snapshots not supported for this endpoint", err} return &httperror.HandlerError{http.StatusBadRequest, "Snapshots not supported for this environment", err}
} }
snapshotError := handler.SnapshotService.SnapshotEndpoint(endpoint) snapshotError := handler.SnapshotService.SnapshotEndpoint(endpoint)
latestEndpointReference, err := handler.DataStore.Endpoint().Endpoint(endpoint.ID) latestEndpointReference, err := handler.DataStore.Endpoint().Endpoint(endpoint.ID)
if latestEndpointReference == nil { if latestEndpointReference == nil {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} }
latestEndpointReference.Status = portainer.EndpointStatusUp latestEndpointReference.Status = portainer.EndpointStatusUp
@ -57,7 +57,7 @@ func (handler *Handler) endpointSnapshot(w http.ResponseWriter, r *http.Request)
err = handler.DataStore.Endpoint().UpdateEndpoint(latestEndpointReference.ID, latestEndpointReference) err = handler.DataStore.Endpoint().UpdateEndpoint(latestEndpointReference.ID, latestEndpointReference)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
return response.Empty(w) return response.Empty(w)

View File

@ -22,7 +22,7 @@ import (
func (handler *Handler) endpointSnapshots(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointSnapshots(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from the database", err}
} }
for _, endpoint := range endpoints { for _, endpoint := range endpoints {
@ -34,13 +34,13 @@ func (handler *Handler) endpointSnapshots(w http.ResponseWriter, r *http.Request
latestEndpointReference, err := handler.DataStore.Endpoint().Endpoint(endpoint.ID) latestEndpointReference, err := handler.DataStore.Endpoint().Endpoint(endpoint.ID)
if latestEndpointReference == nil { if latestEndpointReference == nil {
log.Printf("background schedule error (endpoint snapshot). Endpoint not found inside the database anymore (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err) log.Printf("background schedule error (environment snapshot). Environment not found inside the database anymore (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err)
continue continue
} }
endpoint.Status = portainer.EndpointStatusUp endpoint.Status = portainer.EndpointStatusUp
if snapshotError != nil { if snapshotError != nil {
log.Printf("background schedule error (endpoint snapshot). Unable to create snapshot (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, snapshotError) log.Printf("background schedule error (environment snapshot). Unable to create snapshot (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, snapshotError)
endpoint.Status = portainer.EndpointStatusDown endpoint.Status = portainer.EndpointStatusDown
} }
@ -49,7 +49,7 @@ func (handler *Handler) endpointSnapshots(w http.ResponseWriter, r *http.Request
err = handler.DataStore.Endpoint().UpdateEndpoint(latestEndpointReference.ID, latestEndpointReference) err = handler.DataStore.Endpoint().UpdateEndpoint(latestEndpointReference.ID, latestEndpointReference)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
} }

View File

@ -65,19 +65,19 @@ type endpointStatusInspectResponse struct {
func (handler *Handler) endpointStatusInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointStatusInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if endpoint.EdgeID == "" { if endpoint.EdgeID == "" {
@ -107,7 +107,7 @@ func (handler *Handler) endpointStatusInspect(w http.ResponseWriter, r *http.Req
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to Unable to persist environment changes inside the database", err}
} }
settings, err := handler.DataStore.Settings().Settings() settings, err := handler.DataStore.Settings().Settings()

View File

@ -71,7 +71,7 @@ func (payload *endpointUpdatePayload) Validate(r *http.Request) error {
func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
var payload endpointUpdatePayload var payload endpointUpdatePayload
@ -82,9 +82,9 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if payload.Name != nil { if payload.Name != nil {
@ -257,7 +257,7 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
if payload.URL != nil || payload.TLS != nil || endpoint.Type == portainer.AzureEnvironment { if payload.URL != nil || payload.TLS != nil || endpoint.Type == portainer.AzureEnvironment {
_, err = handler.ProxyManager.CreateAndRegisterEndpointProxy(endpoint) _, err = handler.ProxyManager.CreateAndRegisterEndpointProxy(endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to register HTTP proxy for the endpoint", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to register HTTP proxy for the environment", err}
} }
} }
@ -272,18 +272,18 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment changes inside the database", err}
} }
if (endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment) && (groupIDChanged || tagsChanged) { if (endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment) && (groupIDChanged || tagsChanged) {
relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpoint.ID) relation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpoint.ID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find endpoint relation inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find environment relation inside the database", err}
} }
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(endpoint.GroupID) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(endpoint.GroupID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find endpoint group inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find environment group inside the database", err}
} }
edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups() edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
@ -307,7 +307,7 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpoint.ID, relation) err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpoint.ID, relation)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist endpoint relation changes inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist environment relation changes inside the database", err}
} }
} }

View File

@ -56,12 +56,12 @@ func kubeOnlyMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, request *http.Request) { return http.HandlerFunc(func(rw http.ResponseWriter, request *http.Request) {
endpoint, err := middlewares.FetchEndpoint(request) endpoint, err := middlewares.FetchEndpoint(request)
if err != nil { if err != nil {
httperror.WriteError(rw, http.StatusInternalServerError, "Unable to find an endpoint on request context", err) httperror.WriteError(rw, http.StatusInternalServerError, "Unable to find an environment on request context", err)
return return
} }
if !endpointutils.IsKubernetesEndpoint(endpoint) { if !endpointutils.IsKubernetesEndpoint(endpoint) {
errMessage := "Endpoint is not a kubernetes endpoint" errMessage := "Environment is not a kubernetes environment"
httperror.WriteError(rw, http.StatusBadRequest, errMessage, errors.New(errMessage)) httperror.WriteError(rw, http.StatusBadRequest, errMessage, errors.New(errMessage))
return return
} }

View File

@ -33,19 +33,19 @@ import (
func (handler *Handler) getKubernetesConfig(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) getKubernetesConfig(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.dataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.dataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
tokenData, err := security.RetrieveTokenData(r) tokenData, err := security.RetrieveTokenData(r)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
bearerToken, err := handler.JwtService.GenerateTokenForKubeconfig(tokenData) bearerToken, err := handler.JwtService.GenerateTokenForKubeconfig(tokenData)

View File

@ -28,14 +28,14 @@ import (
func (handler *Handler) getKubernetesNodesLimits(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) getKubernetesNodesLimits(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err}
} }
endpoint, err := handler.dataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.dataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
cli, err := handler.kubernetesClientFactory.GetKubeClient(endpoint) cli, err := handler.kubernetesClientFactory.GetKubeClient(endpoint)

View File

@ -36,7 +36,7 @@ func (payload *namespacesToggleSystemPayload) Validate(r *http.Request) error {
func (handler *Handler) namespacesToggleSystem(rw http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) namespacesToggleSystem(rw http.ResponseWriter, r *http.Request) *httperror.HandlerError {
endpoint, err := middlewares.FetchEndpoint(r) endpoint, err := middlewares.FetchEndpoint(r)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint on request context", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment on request context", err}
} }
namespaceName, err := request.RetrieveRouteVariableValue(r, "namespace") namespaceName, err := request.RetrieveRouteVariableValue(r, "namespace")

View File

@ -71,9 +71,9 @@ func (handler *Handler) stackCreate(w http.ResponseWriter, r *http.Request) *htt
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if endpointutils.IsDockerEndpoint(endpoint) && !endpoint.SecuritySettings.AllowStackManagementForRegularUsers { if endpointutils.IsDockerEndpoint(endpoint) && !endpoint.SecuritySettings.AllowStackManagementForRegularUsers {
@ -96,7 +96,7 @@ func (handler *Handler) stackCreate(w http.ResponseWriter, r *http.Request) *htt
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
tokenData, err := security.RetrieveTokenData(r) tokenData, err := security.RetrieveTokenData(r)

View File

@ -72,9 +72,9 @@ func (handler *Handler) stackDelete(w http.ResponseWriter, r *http.Request) *htt
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find the environment associated to the stack inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the environment associated to the stack inside the database", err}
} }
resourceControl, err := handler.DataStore.ResourceControl().ResourceControlByResourceIDAndType(stackutils.ResourceControlID(stack.EndpointID, stack.Name), portainer.StackResourceControl) resourceControl, err := handler.DataStore.ResourceControl().ResourceControlByResourceIDAndType(stackutils.ResourceControlID(stack.EndpointID, stack.Name), portainer.StackResourceControl)
@ -85,7 +85,7 @@ func (handler *Handler) stackDelete(w http.ResponseWriter, r *http.Request) *htt
if !isOrphaned { if !isOrphaned {
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack { if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {
@ -149,14 +149,14 @@ func (handler *Handler) deleteExternalStack(r *http.Request, w http.ResponseWrit
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find the environment associated to the stack inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the environment associated to the stack inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
stack = &portainer.Stack{ stack = &portainer.Stack{

View File

@ -54,16 +54,16 @@ func (handler *Handler) stackFile(w http.ResponseWriter, r *http.Request) *httpe
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
if !securityContext.IsAdmin { if !securityContext.IsAdmin {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} }
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if endpoint != nil { if endpoint != nil {
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack { if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {

View File

@ -49,16 +49,16 @@ func (handler *Handler) stackInspect(w http.ResponseWriter, r *http.Request) *ht
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
if !securityContext.IsAdmin { if !securityContext.IsAdmin {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} }
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
if endpoint != nil { if endpoint != nil {
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack { if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {

View File

@ -42,7 +42,7 @@ func (handler *Handler) stackList(w http.ResponseWriter, r *http.Request) *httpe
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from database", err}
} }
stacks, err := handler.DataStore.Stack().Stacks() stacks, err := handler.DataStore.Stack().Stacks()

View File

@ -26,7 +26,7 @@ type stackMigratePayload struct {
func (payload *stackMigratePayload) Validate(r *http.Request) error { func (payload *stackMigratePayload) Validate(r *http.Request) error {
if payload.EndpointID == 0 { if payload.EndpointID == 0 {
return errors.New("Invalid endpoint identifier. Must be a positive number") return errors.New("Invalid environment identifier. Must be a positive number")
} }
return nil return nil
} }
@ -68,14 +68,14 @@ func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *ht
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack { if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {
@ -111,9 +111,9 @@ func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *ht
targetEndpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(payload.EndpointID)) targetEndpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(payload.EndpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
stack.EndpointID = portainer.EndpointID(payload.EndpointID) stack.EndpointID = portainer.EndpointID(payload.EndpointID)
@ -132,7 +132,7 @@ func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *ht
} }
if !isUnique { if !isUnique {
errorMessage := fmt.Sprintf("A stack with the name '%s' is already running on endpoint '%s'", stack.Name, targetEndpoint.Name) errorMessage := fmt.Sprintf("A stack with the name '%s' is already running on environment '%s'", stack.Name, targetEndpoint.Name)
return &httperror.HandlerError{http.StatusConflict, errorMessage, errors.New(errorMessage)} return &httperror.HandlerError{http.StatusConflict, errorMessage, errors.New(errorMessage)}
} }

View File

@ -50,14 +50,14 @@ func (handler *Handler) stackStart(w http.ResponseWriter, r *http.Request) *http
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
isUnique, err := handler.checkUniqueName(endpoint, stack.Name, stack.ID, stack.SwarmID != "") isUnique, err := handler.checkUniqueName(endpoint, stack.Name, stack.ID, stack.SwarmID != "")

View File

@ -48,14 +48,14 @@ func (handler *Handler) stackStop(w http.ResponseWriter, r *http.Request) *httpe
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack { if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {

View File

@ -91,14 +91,14 @@ func (handler *Handler) stackUpdate(w http.ResponseWriter, r *http.Request) *htt
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find the endpoint associated to the stack inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find the environment associated to the stack inside the database", Err: err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find the endpoint associated to the stack inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find the environment associated to the stack inside the database", Err: err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusForbidden, Message: "Permission denied to access endpoint", Err: err} return &httperror.HandlerError{StatusCode: http.StatusForbidden, Message: "Permission denied to access environment", Err: err}
} }
securityContext, err := security.RetrieveRestrictedRequestContext(r) securityContext, err := security.RetrieveRestrictedRequestContext(r)

View File

@ -88,14 +88,14 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find the endpoint associated to the stack inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find the environment associated to the stack inside the database", Err: err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find the endpoint associated to the stack inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find the environment associated to the stack inside the database", Err: err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusForbidden, Message: "Permission denied to access endpoint", Err: err} return &httperror.HandlerError{StatusCode: http.StatusForbidden, Message: "Permission denied to access environment", Err: err}
} }
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack { if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {

View File

@ -84,14 +84,14 @@ func (handler *Handler) stackGitRedeploy(w http.ResponseWriter, r *http.Request)
endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find the endpoint associated to the stack inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusNotFound, Message: "Unable to find the environment associated to the stack inside the database", Err: err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find the endpoint associated to the stack inside the database", Err: err} return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to find the environment associated to the stack inside the database", Err: err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusForbidden, Message: "Permission denied to access endpoint", Err: err} return &httperror.HandlerError{StatusCode: http.StatusForbidden, Message: "Permission denied to access environment", Err: err}
} }
securityContext, err := security.RetrieveRestrictedRequestContext(r) securityContext, err := security.RetrieveRestrictedRequestContext(r)

View File

@ -43,7 +43,7 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe
for endpointID := range tag.Endpoints { for endpointID := range tag.Endpoints {
endpoint, err := handler.DataStore.Endpoint().Endpoint(endpointID) endpoint, err := handler.DataStore.Endpoint().Endpoint(endpointID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment from the database", err}
} }
tagIdx := findTagIndex(endpoint.TagIDs, tagID) tagIdx := findTagIndex(endpoint.TagIDs, tagID)
@ -51,7 +51,7 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe
endpoint.TagIDs = removeElement(endpoint.TagIDs, tagIdx) endpoint.TagIDs = removeElement(endpoint.TagIDs, tagIdx)
err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint) err = handler.DataStore.Endpoint().UpdateEndpoint(endpoint.ID, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update endpoint", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update environment", err}
} }
} }
} }
@ -59,7 +59,7 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe
for endpointGroupID := range tag.EndpointGroups { for endpointGroupID := range tag.EndpointGroups {
endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(endpointGroupID) endpointGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(endpointGroupID)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoint group from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environment group from the database", err}
} }
tagIdx := findTagIndex(endpointGroup.TagIDs, tagID) tagIdx := findTagIndex(endpointGroup.TagIDs, tagID)
@ -67,14 +67,14 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe
endpointGroup.TagIDs = removeElement(endpointGroup.TagIDs, tagIdx) endpointGroup.TagIDs = removeElement(endpointGroup.TagIDs, tagIdx)
err = handler.DataStore.EndpointGroup().UpdateEndpointGroup(endpointGroup.ID, endpointGroup) err = handler.DataStore.EndpointGroup().UpdateEndpointGroup(endpointGroup.ID, endpointGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update endpoint group", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update environment group", err}
} }
} }
} }
endpoints, err := handler.DataStore.Endpoint().Endpoints() endpoints, err := handler.DataStore.Endpoint().Endpoints()
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve endpoints from the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve environments from the database", err}
} }
edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups() edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
@ -91,7 +91,7 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe
if (tag.Endpoints[endpoint.ID] || tag.EndpointGroups[endpoint.GroupID]) && (endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment) { if (tag.Endpoints[endpoint.ID] || tag.EndpointGroups[endpoint.GroupID]) && (endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment) {
err = handler.updateEndpointRelations(endpoint, edgeGroups, edgeStacks) err = handler.updateEndpointRelations(endpoint, edgeGroups, edgeStacks)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update endpoint relations in the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update environment relations in the database", err}
} }
} }
} }
@ -103,7 +103,7 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe
edgeGroup.TagIDs = removeElement(edgeGroup.TagIDs, tagIdx) edgeGroup.TagIDs = removeElement(edgeGroup.TagIDs, tagIdx)
err = handler.DataStore.EdgeGroup().UpdateEdgeGroup(edgeGroup.ID, edgeGroup) err = handler.DataStore.EdgeGroup().UpdateEdgeGroup(edgeGroup.ID, edgeGroup)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update endpoint group", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to update environment group", err}
} }
} }
} }

View File

@ -46,9 +46,9 @@ func (handler *Handler) webhookExecute(w http.ResponseWriter, r *http.Request) *
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment with the specified identifier inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an environment with the specified identifier inside the database", err}
} }
imageTag, _ := request.RetrieveQueryParameter(r, "tag", true) imageTag, _ := request.RetrieveQueryParameter(r, "tag", true)

View File

@ -48,14 +48,14 @@ func (handler *Handler) websocketAttach(w http.ResponseWriter, r *http.Request)
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find the environment associated to the stack inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the environment associated to the stack inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
params := &webSocketRequestParams{ params := &webSocketRequestParams{

View File

@ -55,14 +55,14 @@ func (handler *Handler) websocketExec(w http.ResponseWriter, r *http.Request) *h
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == errors.ErrObjectNotFound { if err == errors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find the environment associated to the stack inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the environment associated to the stack inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
params := &webSocketRequestParams{ params := &webSocketRequestParams{

View File

@ -64,14 +64,14 @@ func (handler *Handler) websocketPodExec(w http.ResponseWriter, r *http.Request)
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find the environment associated to the stack inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the environment associated to the stack inside the database", err}
} }
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint) err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
serviceAccountToken, isAdminToken, err := handler.getToken(r, endpoint, false) serviceAccountToken, isAdminToken, err := handler.getToken(r, endpoint, false)

View File

@ -25,14 +25,14 @@ func (handler *Handler) websocketShellPodExec(w http.ResponseWriter, r *http.Req
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID)) endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
return &httperror.HandlerError{http.StatusNotFound, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusNotFound, "Unable to find the environment associated to the stack inside the database", err}
} else if err != nil { } else if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the endpoint associated to the stack inside the database", err} return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find the environment associated to the stack inside the database", err}
} }
tokenData, err := security.RetrieveTokenData(r) tokenData, err := security.RetrieveTokenData(r)
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access environment", err}
} }
cli, err := handler.KubernetesClientFactory.GetKubeClient(endpoint) cli, err := handler.KubernetesClientFactory.GetKubeClient(endpoint)

View File

@ -25,7 +25,7 @@ func WithEndpoint(endpointService portainer.EndpointService, endpointIDParam str
endpointID, err := requesthelpers.RetrieveNumericRouteVariableValue(request, endpointIDParam) endpointID, err := requesthelpers.RetrieveNumericRouteVariableValue(request, endpointIDParam)
if err != nil { if err != nil {
httperror.WriteError(rw, http.StatusBadRequest, "Invalid endpoint identifier route variable", err) httperror.WriteError(rw, http.StatusBadRequest, "Invalid environment identifier route variable", err)
return return
} }
@ -36,7 +36,7 @@ func WithEndpoint(endpointService portainer.EndpointService, endpointIDParam str
if err == bolterrors.ErrObjectNotFound { if err == bolterrors.ErrObjectNotFound {
statusCode = http.StatusNotFound statusCode = http.StatusNotFound
} }
httperror.WriteError(rw, statusCode, "Unable to find an endpoint with the specified identifier inside the database", err) httperror.WriteError(rw, statusCode, "Unable to find an environment with the specified identifier inside the database", err)
return return
} }
@ -51,7 +51,7 @@ func WithEndpoint(endpointService portainer.EndpointService, endpointIDParam str
func FetchEndpoint(request *http.Request) (*portainer.Endpoint, error) { func FetchEndpoint(request *http.Request) (*portainer.Endpoint, error) {
contextData := request.Context().Value(contextEndpoint) contextData := request.Context().Value(contextEndpoint)
if contextData == nil { if contextData == nil {
return nil, errors.New("Unable to find endpoint data in request context") return nil, errors.New("Unable to find environment data in request context")
} }
return contextData.(*portainer.Endpoint), nil return contextData.(*portainer.Endpoint), nil

View File

@ -113,7 +113,7 @@ func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endp
// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge endpoint // AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge endpoint
func (bouncer *RequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error { func (bouncer *RequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment { if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment {
return errors.New("Invalid endpoint type") return errors.New("Invalid environment type")
} }
edgeIdentifier := r.Header.Get(portainer.PortainerAgentEdgeIDHeader) edgeIdentifier := r.Header.Get(portainer.PortainerAgentEdgeIDHeader)

View File

@ -126,7 +126,7 @@ func (service *Service) startSnapshotLoop() error {
go func() { go func() {
err := service.snapshotEndpoints() err := service.snapshotEndpoints()
if err != nil { if err != nil {
log.Printf("[ERROR] [internal,snapshot] [message: background schedule error (endpoint snapshot).] [error: %s]", err) log.Printf("[ERROR] [internal,snapshot] [message: background schedule error (environment snapshot).] [error: %s]", err)
} }
for { for {
@ -134,7 +134,7 @@ func (service *Service) startSnapshotLoop() error {
case <-ticker.C: case <-ticker.C:
err := service.snapshotEndpoints() err := service.snapshotEndpoints()
if err != nil { if err != nil {
log.Printf("[ERROR] [internal,snapshot] [message: background schedule error (endpoint snapshot).] [error: %s]", err) log.Printf("[ERROR] [internal,snapshot] [message: background schedule error (environment snapshot).] [error: %s]", err)
} }
case <-service.shutdownCtx.Done(): case <-service.shutdownCtx.Done():
log.Println("[DEBUG] [internal,snapshot] [message: shutting down snapshotting]") log.Println("[DEBUG] [internal,snapshot] [message: shutting down snapshotting]")
@ -166,13 +166,13 @@ func (service *Service) snapshotEndpoints() error {
latestEndpointReference, err := service.dataStore.Endpoint().Endpoint(endpoint.ID) latestEndpointReference, err := service.dataStore.Endpoint().Endpoint(endpoint.ID)
if latestEndpointReference == nil { if latestEndpointReference == nil {
log.Printf("background schedule error (endpoint snapshot). Endpoint not found inside the database anymore (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err) log.Printf("background schedule error (environment snapshot). Environment not found inside the database anymore (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err)
continue continue
} }
latestEndpointReference.Status = portainer.EndpointStatusUp latestEndpointReference.Status = portainer.EndpointStatusUp
if snapshotError != nil { if snapshotError != nil {
log.Printf("background schedule error (endpoint snapshot). Unable to create snapshot (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, snapshotError) log.Printf("background schedule error (environment snapshot). Unable to create snapshot (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, snapshotError)
latestEndpointReference.Status = portainer.EndpointStatusDown latestEndpointReference.Status = portainer.EndpointStatusDown
} }
@ -181,7 +181,7 @@ func (service *Service) snapshotEndpoints() error {
err = service.dataStore.Endpoint().UpdateEndpoint(latestEndpointReference.ID, latestEndpointReference) err = service.dataStore.Endpoint().UpdateEndpoint(latestEndpointReference.ID, latestEndpointReference)
if err != nil { if err != nil {
log.Printf("background schedule error (endpoint snapshot). Unable to update endpoint (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err) log.Printf("background schedule error (environment snapshot). Unable to update environment (endpoint=%s, URL=%s) (err=%s)\n", endpoint.Name, endpoint.URL, err)
continue continue
} }
} }
@ -201,12 +201,12 @@ func FetchDockerID(snapshot portainer.DockerSnapshot) (string, error) {
} }
if info["Swarm"] == nil { if info["Swarm"] == nil {
return "", errors.New("swarm endpoint is missing swarm info snapshot") return "", errors.New("swarm environment is missing swarm info snapshot")
} }
swarmInfo := info["Swarm"].(map[string]interface{}) swarmInfo := info["Swarm"].(map[string]interface{})
if swarmInfo["Cluster"] == nil { if swarmInfo["Cluster"] == nil {
return "", errors.New("swarm endpoint is missing cluster info snapshot") return "", errors.New("swarm environment is missing cluster info snapshot")
} }
clusterInfo := swarmInfo["Cluster"].(map[string]interface{}) clusterInfo := swarmInfo["Cluster"].(map[string]interface{})

View File

@ -94,7 +94,7 @@ func (factory *ClientFactory) CreateClient(endpoint *portainer.Endpoint) (*kuber
return factory.buildEdgeClient(endpoint) return factory.buildEdgeClient(endpoint)
} }
return nil, errors.New("unsupported endpoint type") return nil, errors.New("unsupported environment type")
} }
type agentHeaderRoundTripper struct { type agentHeaderRoundTripper struct {
@ -125,7 +125,7 @@ func (factory *ClientFactory) buildEdgeClient(endpoint *portainer.Endpoint) (*ku
if tunnel.Status == portainer.EdgeAgentIdle { if tunnel.Status == portainer.EdgeAgentIdle {
err := factory.reverseTunnelService.SetTunnelStatusToRequired(endpoint.ID) err := factory.reverseTunnelService.SetTunnelStatusToRequired(endpoint.ID)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed opening tunnel to endpoint: %w", err) return nil, fmt.Errorf("failed opening tunnel to environment: %w", err)
} }
if endpoint.EdgeCheckinInterval == 0 { if endpoint.EdgeCheckinInterval == 0 {

View File

@ -51,7 +51,7 @@ func RedeployWhenChanged(stackID portainer.StackID, deployer StackDeployer, data
endpoint, err := datastore.Endpoint().Endpoint(stack.EndpointID) endpoint, err := datastore.Endpoint().Endpoint(stack.EndpointID)
if err != nil { if err != nil {
return errors.WithMessagef(err, "failed to find the endpoint %v associated to the stack %v", stack.EndpointID, stack.ID) return errors.WithMessagef(err, "failed to find the environment %v associated to the stack %v", stack.EndpointID, stack.ID)
} }
author := stack.UpdatedBy author := stack.UpdatedBy

View File

@ -101,7 +101,7 @@ func Test_redeployWhenChanged(t *testing.T) {
tmpDir, _ := ioutil.TempDir("", "stack") tmpDir, _ := ioutil.TempDir("", "stack")
err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1}) err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1})
assert.NoError(t, err, "error creating endpoint") assert.NoError(t, err, "error creating environment")
username := "user" username := "user"
err = store.User().CreateUser(&portainer.User{Username: username, Role: portainer.AdministratorRole}) err = store.User().CreateUser(&portainer.User{Username: username, Role: portainer.AdministratorRole})

View File

@ -20,7 +20,7 @@ angular.module('portainer.azure', ['portainer.app']).config([
EndpointProvider.setOfflineModeFromStatus(endpoint.Status); EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
await StateManager.updateEndpointState(endpoint, []); await StateManager.updateEndpointState(endpoint, []);
} catch (e) { } catch (e) {
Notifications.error('Failed loading endpoint', e); Notifications.error('Failed loading environment', e);
$state.go('portainer.home', {}, { reload: true }); $state.go('portainer.home', {}, { reload: true });
} }
}); });

View File

@ -24,10 +24,10 @@ angular.module('portainer.docker', ['portainer.app']).config([
if (status === 2) { if (status === 2) {
if (!endpoint.Snapshots[0]) { if (!endpoint.Snapshots[0]) {
throw new Error('Endpoint is unreachable and there is no snapshot available for offline browsing.'); throw new Error('Environment is unreachable and there is no snapshot available for offline browsing.');
} }
if (endpoint.Snapshots[0].Swarm) { if (endpoint.Snapshots[0].Swarm) {
throw new Error('Endpoint is unreachable. Connect to another swarm manager.'); throw new Error('Environment is unreachable. Connect to another swarm manager.');
} }
} }
@ -38,7 +38,7 @@ angular.module('portainer.docker', ['portainer.app']).config([
const extensions = await LegacyExtensionManager.initEndpointExtensions(endpoint); const extensions = await LegacyExtensionManager.initEndpointExtensions(endpoint);
await StateManager.updateEndpointState(endpoint, extensions); await StateManager.updateEndpointState(endpoint, extensions);
} catch (e) { } catch (e) {
Notifications.error('Failed loading endpoint', e); Notifications.error('Failed loading environment', e);
$state.go('portainer.home', {}, { reload: true }); $state.go('portainer.home', {}, { reload: true });
} }

View File

@ -1,6 +1,6 @@
<rd-header> <rd-header>
<rd-header-title title-text="Dashboard"></rd-header-title> <rd-header-title title-text="Dashboard"></rd-header-title>
<rd-header-content>Endpoint summary</rd-header-content> <rd-header-content>Environment summary</rd-header-content>
</rd-header> </rd-header>
<div class="row" ng-if="applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'"> <div class="row" ng-if="applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">
@ -34,12 +34,12 @@
<div class="row" ng-if="(!applicationState.endpoint.mode.agentProxy || applicationState.endpoint.mode.provider !== 'DOCKER_SWARM_MODE') && info && endpoint"> <div class="row" ng-if="(!applicationState.endpoint.mode.agentProxy || applicationState.endpoint.mode.provider !== 'DOCKER_SWARM_MODE') && info && endpoint">
<div class="col-sm-12"> <div class="col-sm-12">
<rd-widget> <rd-widget>
<rd-widget-header icon="fa-tachometer-alt" title-text="Endpoint info"></rd-widget-header> <rd-widget-header icon="fa-tachometer-alt" title-text="Environment info"></rd-widget-header>
<rd-widget-body classes="no-padding"> <rd-widget-body classes="no-padding">
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <tr>
<td>Endpoint</td> <td>Environment</td>
<td> <td>
{{ endpoint.Name }} {{ endpoint.Name }}
<span class="small text-muted space-left"> <span class="small text-muted space-left">

View File

@ -14,7 +14,7 @@
<div ng-if="!$ctrl.isAgent" class="form-group"> <div ng-if="!$ctrl.isAgent" class="form-group">
<span class="col-sm-12 text-muted small"> <span class="col-sm-12 text-muted small">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i> <i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
These features are only available for an Agent enabled endpoints. These features are only available for an Agent enabled environments.
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -52,7 +52,7 @@
<td colspan="5" class="text-center text-muted">Loading...</td> <td colspan="5" class="text-center text-muted">Loading...</td>
</tr> </tr>
<tr ng-if="!$ctrl.state.loading && $ctrl.state.filteredDataSet.length === 0"> <tr ng-if="!$ctrl.state.loading && $ctrl.state.filteredDataSet.length === 0">
<td colspan="5" class="text-center text-muted">No endpoint available.</td> <td colspan="5" class="text-center text-muted">No environment available.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -75,7 +75,7 @@
<input class="form-control" moment-picker ng-model="$ctrl.formValues.datetime" format="YYYY-MM-DD HH:mm" /> <input class="form-control" moment-picker ng-model="$ctrl.formValues.datetime" format="YYYY-MM-DD HH:mm" />
</div> </div>
<div class="col-sm-12 small text-muted" style="margin-top: 10px;"> <div class="col-sm-12 small text-muted" style="margin-top: 10px;">
Time should be set according to the chosen endpoints' timezone. Time should be set according to the chosen environments' timezone.
</div> </div>
<div ng-show="edgeJobForm.datepicker.$invalid"> <div ng-show="edgeJobForm.datepicker.$invalid">
<div class="col-sm-12 small text-warning"> <div class="col-sm-12 small text-warning">
@ -130,7 +130,7 @@
/> />
</div> </div>
<div class="col-sm-12 small text-muted" style="margin-top: 10px;"> <div class="col-sm-12 small text-muted" style="margin-top: 10px;">
Time should be set according to the chosen endpoints' timezone. Time should be set according to the chosen environments' timezone.
</div> </div>
</div> </div>
<div class="form-group" ng-show="edgeJobForm.edgejob_cron.$invalid && edgeJobForm.edgejob_cron.$dirty"> <div class="form-group" ng-show="edgeJobForm.edgejob_cron.$invalid && edgeJobForm.edgejob_cron.$dirty">
@ -215,7 +215,7 @@
</div> </div>
<!-- !upload --> <!-- !upload -->
<div class="col-sm-12 form-section-title"> <div class="col-sm-12 form-section-title">
Target endpoints Target environments
</div> </div>
<!-- node-selection --> <!-- node-selection -->
<associated-endpoints-selector <associated-endpoints-selector

View File

@ -19,7 +19,7 @@
<a ng-click="$ctrl.changeOrderBy('Endpoint')"> <a ng-click="$ctrl.changeOrderBy('Endpoint')">
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoint' && !$ctrl.state.reverseOrder"></i> <i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoint' && !$ctrl.state.reverseOrder"></i>
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoint' && $ctrl.state.reverseOrder"></i> <i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoint' && $ctrl.state.reverseOrder"></i>
Endpoint Environment
</a> </a>
</th> </th>
<th> <th>

View File

@ -57,7 +57,7 @@
<td colspan="5" class="text-center text-muted">Loading...</td> <td colspan="5" class="text-center text-muted">Loading...</td>
</tr> </tr>
<tr ng-if="!$ctrl.state.loading && $ctrl.state.filteredDataSet.length === 0"> <tr ng-if="!$ctrl.state.loading && $ctrl.state.filteredDataSet.length === 0">
<td colspan="5" class="text-center text-muted">No endpoint available.</td> <td colspan="5" class="text-center text-muted">No environment available.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -101,7 +101,7 @@ export class EdgeStackEndpointsDatatableController {
this.state.filteredDataSet = endpoints; this.state.filteredDataSet = endpoints;
this.state.totalFilteredDataSet = totalCount; this.state.totalFilteredDataSet = totalCount;
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoints'); this.Notifications.error('Failure', err, 'Unable to retrieve environments');
} finally { } finally {
this.state.loading = false; this.state.loading = false;
} }

View File

@ -1,3 +1,3 @@
<span class="status" title="Acknowledged endpoints"><i class="acknowledged icon"></i>{{ $ctrl.status.acknowledged || 0 }}</span> <span class="status" title="Acknowledged environments"><i class="acknowledged icon"></i>{{ $ctrl.status.acknowledged || 0 }}</span>
<span class="status" title="Successful endpoints"><i class="ok icon"></i>{{ $ctrl.status.ok || 0 }}</span> <span class="status" title="Successful environments"><i class="ok icon"></i>{{ $ctrl.status.ok || 0 }}</span>
<span class="status" title="Failed endpoints"><i class="error icon"></i>{{ $ctrl.status.error || 0 }}</span> <span class="status" title="Failed environments"><i class="error icon"></i>{{ $ctrl.status.error || 0 }}</span>

View File

@ -30,7 +30,7 @@
<i class="fa fa-list-ol" aria-hidden="true" style="margin-right: 2px;"></i> <i class="fa fa-list-ol" aria-hidden="true" style="margin-right: 2px;"></i>
Static Static
</div> </div>
<p>Manually select Edge endpoints</p> <p>Manually select Edge environments</p>
</label> </label>
</div> </div>
<div class="boxselector"> <div class="boxselector">
@ -40,7 +40,7 @@
<i class="fa fa-tags" aria-hidden="true" style="margin-right: 2px;"></i> <i class="fa fa-tags" aria-hidden="true" style="margin-right: 2px;"></i>
Dynamic Dynamic
</div> </div>
<p>Automatically associate endpoints via tags</p> <p>Automatically associate environments via tags</p>
</label> </label>
</div> </div>
</div> </div>
@ -49,9 +49,9 @@
<!-- StaticGroup --> <!-- StaticGroup -->
<div ng-if="!$ctrl.model.Dynamic"> <div ng-if="!$ctrl.model.Dynamic">
<div ng-if="!$ctrl.noEndpoints"> <div ng-if="!$ctrl.noEndpoints">
<!-- endpoints --> <!-- environments -->
<div class="col-sm-12 form-section-title"> <div class="col-sm-12 form-section-title">
Associated endpoints Associated environments
</div> </div>
<div class="form-group"> <div class="form-group">
<associated-endpoints-selector <associated-endpoints-selector
@ -65,7 +65,7 @@
</div> </div>
</div> </div>
<div class="form-group" ng-if="$ctrl.noEndpoints"> <div class="form-group" ng-if="$ctrl.noEndpoints">
<div class="col-sm-12 small text-muted"> No Edge endpoints are available. Head over to the <a ui-sref="portainer.endpoints">Endpoints view</a> to add endpoints. </div> <div class="col-sm-12 small text-muted"> No Edge environments are available. Head over to the <a ui-sref="portainer.endpoints">Environments view</a> to add environments. </div>
</div> </div>
</div> </div>
<!-- !StaticGroup --> <!-- !StaticGroup -->
@ -84,7 +84,7 @@
<i class="fa fa-tag" aria-hidden="true" style="margin-right: 2px;"></i> <i class="fa fa-tag" aria-hidden="true" style="margin-right: 2px;"></i>
Partial match Partial match
</div> </div>
<p>Associate any endpoint matching at least one of the selected tags</p> <p>Associate any environment matching at least one of the selected tags</p>
</label> </label>
</div> </div>
<div class="boxselector"> <div class="boxselector">
@ -94,7 +94,7 @@
<i class="fa fa-tag" aria-hidden="true" style="margin-right: 2px;"></i> <i class="fa fa-tag" aria-hidden="true" style="margin-right: 2px;"></i>
Full match Full match
</div> </div>
<p>Associate any endpoint matching all of the selected tags</p> <p>Associate any environment matching all of the selected tags</p>
</label> </label>
</div> </div>
</div> </div>
@ -106,7 +106,7 @@
</div> </div>
</div> </div>
<div class="col-sm-12 form-section-title"> <div class="col-sm-12 form-section-title">
Associated endpoints by tags Associated environments by tags
</div> </div>
<div class="col-sm-12 form-group"> <div class="col-sm-12 form-group">
<group-association-table <group-association-table

View File

@ -45,7 +45,7 @@
</th> </th>
<th> <th>
<a ng-click="$ctrl.changeOrderBy('Endpoints.length')"> <a ng-click="$ctrl.changeOrderBy('Endpoints.length')">
Endpoints Count Environments Count
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoints.length' && !$ctrl.state.reverseOrder"></i> <i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoints.length' && !$ctrl.state.reverseOrder"></i>
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoints.length' && $ctrl.state.reverseOrder"></i> <i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Endpoints.length' && $ctrl.state.reverseOrder"></i>
</a> </a>

View File

@ -161,7 +161,7 @@ export class EdgeJobController {
this.results = results; this.results = results;
} }
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoint list'); this.Notifications.error('Failure', err, 'Unable to retrieve environment list');
} }
this.$window.onbeforeunload = () => { this.$window.onbeforeunload = () => {

View File

@ -26,11 +26,11 @@
</div> </div>
</uib-tab> </uib-tab>
<uib-tab index="1" classes="btn-sm"> <uib-tab index="1" classes="btn-sm">
<uib-tab-heading> <i class="fa fa-plug space-right" aria-hidden="true"></i> Endpoints</uib-tab-heading> <uib-tab-heading> <i class="fa fa-plug space-right" aria-hidden="true"></i> Environments</uib-tab-heading>
<div style="margin-top: 25px;"> <div style="margin-top: 25px;">
<edge-stack-endpoints-datatable <edge-stack-endpoints-datatable
title-text="Endpoints Status" title-text="Environments Status"
dataset="$ctrl.endpoints" dataset="$ctrl.endpoints"
title-icon="fa-plug" title-icon="fa-plug"
table-key="edgeStackEndpoints" table-key="edgeStackEndpoints"

View File

@ -108,7 +108,7 @@ export class EditEdgeStackViewController {
}); });
return { endpoints, totalCount }; return { endpoints, totalCount };
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoint information'); this.Notifications.error('Failure', err, 'Unable to retrieve environment information');
} }
} }
} }

View File

@ -38,7 +38,7 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
await KubernetesNamespaceService.get(); await KubernetesNamespaceService.get();
} catch (e) { } catch (e) {
Notifications.error('Failed loading endpoint', e); Notifications.error('Failed loading environment', e);
$state.go('portainer.home', {}, { reload: true }); $state.go('portainer.home', {}, { reload: true });
} }
}); });

View File

@ -20,7 +20,7 @@ class KubernetesEndpointService {
const data = await this.KubernetesEndpoints(namespace).get().$promise; const data = await this.KubernetesEndpoints(namespace).get().$promise;
return _.map(data.items, (item) => KubernetesEndpointConverter.apiToEndpoint(item)); return _.map(data.items, (item) => KubernetesEndpointConverter.apiToEndpoint(item));
} catch (err) { } catch (err) {
throw new PortainerError('Unable to retrieve endpoints', err); throw new PortainerError('Unable to retrieve environments', err);
} }
} }

View File

@ -926,7 +926,7 @@
</p> </p>
<p ng-if="ctrl.isAdmin"> <p ng-if="ctrl.isAdmin">
Server metrics features must be enabled in the Server metrics features must be enabled in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: ctrl.endpoint.Id})" class="ctrl.isAdmin">endpoint configuration view</a>. <a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: ctrl.endpoint.Id})" class="ctrl.isAdmin">environment configuration view</a>.
</p> </p>
</div> </div>
</div> </div>

View File

@ -66,7 +66,7 @@ class KubernetesClusterController {
}); });
} }
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoints'); this.Notifications.error('Failure', err, 'Unable to retrieve environments');
} }
} }

View File

@ -238,7 +238,7 @@ class KubernetesNodeController {
}); });
} }
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoints'); this.Notifications.error('Failure', err, 'Unable to retrieve environments');
} }
} }

View File

@ -1,5 +1,5 @@
<kubernetes-view-header title="Kubernetes features configuration" state="portainer.endpoints.endpoint.kubernetesConfig" view-ready="ctrl.state.viewReady"> <kubernetes-view-header title="Kubernetes features configuration" state="portainer.endpoints.endpoint.kubernetesConfig" view-ready="ctrl.state.viewReady">
<a ui-sref="portainer.endpoints">Endpoints</a> &gt; <a ui-sref="portainer.endpoints.endpoint({id: ctrl.endpoint.Id})">{{ ctrl.endpoint.Name }}</a> &gt; Kubernetes configuration <a ui-sref="portainer.endpoints">Environment</a> &gt; <a ui-sref="portainer.endpoints.endpoint({id: ctrl.endpoint.Id})">{{ ctrl.endpoint.Name }}</a> &gt; Kubernetes configuration
</kubernetes-view-header> </kubernetes-view-header>
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading> <kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>

View File

@ -294,7 +294,7 @@ class KubernetesConfigureController {
this.oldFormValues = Object.assign({}, this.formValues); this.oldFormValues = Object.assign({}, this.formValues);
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve endpoint configuration'); this.Notifications.error('Failure', err, 'Unable to retrieve environment configuration');
} finally { } finally {
this.state.viewReady = true; this.state.viewReady = true;
} }

View File

@ -1,5 +1,5 @@
<kubernetes-view-header title="Dashboard" state="kubernetes.dashboard" view-ready="ctrl.state.viewReady"> <kubernetes-view-header title="Dashboard" state="kubernetes.dashboard" view-ready="ctrl.state.viewReady">
Endpoint summary Environment summary
</kubernetes-view-header> </kubernetes-view-header>
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading> <kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>
@ -8,12 +8,12 @@
<div class="row" ng-if="ctrl.endpoint"> <div class="row" ng-if="ctrl.endpoint">
<div class="col-sm-12"> <div class="col-sm-12">
<rd-widget> <rd-widget>
<rd-widget-header icon="fa-tachometer-alt" title-text="Endpoint info"></rd-widget-header> <rd-widget-header icon="fa-tachometer-alt" title-text="Environment info"></rd-widget-header>
<rd-widget-body classes="no-padding"> <rd-widget-body classes="no-padding">
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <tr>
<td>Endpoint</td> <td>Environment</td>
<td> <td>
{{ ctrl.endpoint.Name }} {{ ctrl.endpoint.Name }}
</td> </td>

View File

@ -38,8 +38,8 @@
</label> </label>
<div class="col-sm-9 col-lg-4"> <div class="col-sm-9 col-lg-4">
<span class="small text-muted" ng-if="ctrl.availableUsersAndTeams.length === 0"> <span class="small text-muted" ng-if="ctrl.availableUsersAndTeams.length === 0">
No user nor team access has been set on the endpoint. Head over to the No user nor team access has been set on the environment. Head over to the
<a ui-sref="portainer.endpoints.endpoint.access({id: ctrl.endpointId})">endpoint access view</a> to manage them. <a ui-sref="portainer.endpoints.endpoint.access({id: ctrl.endpointId})">environment access view</a> to manage them.
</span> </span>
<span <span
isteven-multi-select isteven-multi-select

View File

@ -213,7 +213,7 @@
<div class="form-group" ng-if="$ctrl.formValues.IngressClasses.length === 0"> <div class="form-group" ng-if="$ctrl.formValues.IngressClasses.length === 0">
<div class="col-sm-12 small text-muted"> <div class="col-sm-12 small text-muted">
The ingress feature must be enabled in the The ingress feature must be enabled in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: $ctrl.endpoint.Id})">endpoint configuration view</a> to be able to register ingresses inside this <a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: $ctrl.endpoint.Id})">environment configuration view</a> to be able to register ingresses inside this
namespace. namespace.
</div> </div>
</div> </div>

View File

@ -165,7 +165,7 @@
<div class="form-group" ng-if="ctrl.formValues.IngressClasses.length === 0"> <div class="form-group" ng-if="ctrl.formValues.IngressClasses.length === 0">
<div class="col-sm-12 small text-muted"> <div class="col-sm-12 small text-muted">
The ingress feature must be enabled in the The ingress feature must be enabled in the
<a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: ctrl.endpoint.Id})">endpoint configuration view</a> to be able to register ingresses inside <a ui-sref="portainer.endpoints.endpoint.kubernetesConfig({id: ctrl.endpoint.Id})">environment configuration view</a> to be able to register ingresses inside
this namespace. this namespace.
</div> </div>
</div> </div>

Some files were not shown because too many files have changed in this diff Show More