returnnil,handler.handlerDBErr(err,"Unable to find an environment with the specified identifier inside the database")
returnnil,handler.handlerDBErr(fmt.Errorf("unable to find the environment from the database: %w. Environment ID: %d",err,payload.EndpointID),"unable to find the environment")
returnnil,handler.handlerDBErr(err,"Unable to persist the stack changes inside the database")
returnnil,handler.handlerDBErr(fmt.Errorf("unable to update Edge stack to the database: %w. Environment name: %s",err,endpoint.Name),"unable to update Edge stack")
returnhttperror.NotFound("Unable to find an edge stack with the specified identifier inside the database", err)
returnhttperror.NotFound("Unable to find an edge stack with the specified identifier inside the database",fmt.Errorf("unable to find the Edge stack from database: %w. Environment name: %s",err,endpoint.Name))
}elseiferr!=nil{
returnhttperror.InternalServerError("Unable to find an edge stack with the specified identifier inside the database", err)
returnhttperror.InternalServerError("Unable to find an edge stack with the specified identifier inside the database",fmt.Errorf("failed to find the Edge stack from database: %w. Environment name: %s",err,endpoint.Name))
}
fileName:=edgeStack.EntryPoint
ifendpointutils.IsDockerEndpoint(endpoint){
iffileName==""{
returnhttperror.BadRequest("Docker is not supported by this stack",errors.New("Docker is not supported by this stack"))
returnhttperror.BadRequest("Docker is not supported by this stack",fmt.Errorf("no filename is provided for the Docker endpoint. Environment name: %s",endpoint.Name))
returnhttperror.BadRequest("Kubernetes is not supported by this stack",errors.New("Kubernetes is not supported by this stack"))
returnhttperror.BadRequest("Kubernetes is not supported by this stack",fmt.Errorf("no filename is provided for the Kubernetes endpoint. Environment name: %s",endpoint.Name))
returnhttperror.Forbidden("Permission denied to access environment",errors.New("the device has not been trusted yet"))
returnhttperror.Forbidden("Permission denied to access environment. The device has not been trusted yet",fmt.Errorf("unable to retrieve endpoint heartbeat. Environment ID: %d",endpointID))
returnhttperror.Forbidden("Permission denied to access environment",errors.New("the device has not been trusted yet"))
returnhttperror.Forbidden("Permission denied to access environment. The device has not been trusted yet",fmt.Errorf("unable to retrieve endpoint from database: %w. Environment ID: %d",err,endpointID))
returnhttperror.Forbidden("Permission denied to access environment",err)
returnhttperror.Forbidden("Permission denied to access environment. The device has not been trusted yet",fmt.Errorf("unauthorized Edge endpoint operation: %w. Environment name: %s",err,endpoint.Name))
returnhttperror.Forbidden("Permission denied to access environment",err)
returnhttperror.Forbidden("Permission denied to access environment. The device has not been trusted yet",fmt.Errorf("untrusted Edge environment access: %w. Environment name: %s",err,endpoint.Name))