[API节点]支持HTTP API

This commit is contained in:
刘祥超
2021-01-01 20:49:09 +08:00
parent f905bb7066
commit b4ab1f0ec8
18 changed files with 667 additions and 80 deletions

View File

@@ -19,7 +19,7 @@ func (this *APINodeService) CreateAPINode(ctx context.Context, req *pb.CreateAPI
return nil, err
}
nodeId, err := models.SharedAPINodeDAO.CreateAPINode(req.Name, req.Description, req.HttpJSON, req.HttpsJSON, req.AccessAddrsJSON, req.IsOn)
nodeId, err := models.SharedAPINodeDAO.CreateAPINode(req.Name, req.Description, req.HttpJSON, req.HttpsJSON, req.RestIsOn, req.RestHTTPJSON, req.RestHTTPSJSON, req.AccessAddrsJSON, req.IsOn)
if err != nil {
return nil, err
}
@@ -34,7 +34,7 @@ func (this *APINodeService) UpdateAPINode(ctx context.Context, req *pb.UpdateAPI
return nil, err
}
err = models.SharedAPINodeDAO.UpdateAPINode(req.NodeId, req.Name, req.Description, req.HttpJSON, req.HttpsJSON, req.AccessAddrsJSON, req.IsOn)
err = models.SharedAPINodeDAO.UpdateAPINode(req.NodeId, req.Name, req.Description, req.HttpJSON, req.HttpsJSON, req.RestIsOn, req.RestHTTPJSON, req.RestHTTPSJSON, req.AccessAddrsJSON, req.IsOn)
if err != nil {
return nil, err
}
@@ -138,6 +138,9 @@ func (this *APINodeService) ListEnabledAPINodes(ctx context.Context, req *pb.Lis
Description: node.Description,
HttpJSON: []byte(node.Http),
HttpsJSON: []byte(node.Https),
RestIsOn: node.RestIsOn == 1,
RestHTTPJSON: []byte(node.RestHTTP),
RestHTTPSJSON: []byte(node.RestHTTPS),
AccessAddrsJSON: []byte(node.AccessAddrs),
AccessAddrs: accessAddrs,
StatusJSON: []byte(node.Status),
@@ -178,6 +181,9 @@ func (this *APINodeService) FindEnabledAPINode(ctx context.Context, req *pb.Find
Description: node.Description,
HttpJSON: []byte(node.Http),
HttpsJSON: []byte(node.Https),
RestIsOn: node.RestIsOn == 1,
RestHTTPJSON: []byte(node.RestHTTP),
RestHTTPSJSON: []byte(node.RestHTTPS),
AccessAddrsJSON: []byte(node.AccessAddrs),
AccessAddrs: accessAddrs,
}