23 lines
889 B
Go
23 lines
889 B
Go
package panel
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"net/http"
|
|
)
|
|
|
|
// Stateless mode retains only local panel credentials, never a platform
|
|
// resource registry. The network gateway cannot reconfigure credentials.
|
|
func(s *BrokerServer) EnableStateless()error{
|
|
if s.direct==nil{return errors.New("local panel credentials must be configured before enabling the node broker")}
|
|
s.stateless=true;s.registry=brokerRegistry{};return nil
|
|
}
|
|
func(s *BrokerServer) scopedOperations(w http.ResponseWriter,r *http.Request){
|
|
var input ScopedExecution
|
|
if !brokerDecode(w,r,&input){return}
|
|
s.mu.Lock();defer s.mu.Unlock()
|
|
result,err:=ExecuteScoped(r.Context(),s.direct,s.tenantRoot,input)
|
|
if err!=nil{brokerWriteError(w,http.StatusUnprocessableEntity,safeBrokerError("节点面板操作失败",err));return}
|
|
w.Header().Set("Content-Type","application/json");_ = json.NewEncoder(w).Encode(result)
|
|
}
|