| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428 |
- syntax = "v1"
- type Request {
- Name string `path:"name,options=you|me"`
- }
- type Response {
- Message string `json:"message"`
- }
- type DbPingResponse {
- Ok bool `json:"ok"`
- Version string `json:"version"`
- Database string `json:"database"`
- }
- type DeleteResp {
- Ok bool `json:"ok"`
- }
- type CreateDirectoryReq {
- Id int64 `json:"id,optional"`
- ServiceId int64 `json:"serviceId,optional"`
- Directory string `json:"directory,optional"`
- }
- type UpdateDirectoryReq {
- Id int64 `path:"id"`
- ServiceId int64 `json:"serviceId,optional"`
- Directory string `json:"directory,optional"`
- }
- type DirectoryIdReq {
- Id int64 `path:"id"`
- }
- type DirectoryResp {
- Id int64 `json:"id"`
- ServiceId int64 `json:"serviceId"`
- Directory string `json:"directory"`
- }
- type ListDirectoryReq {
- Page int64 `form:"page,optional"`
- PageSize int64 `form:"pageSize,optional"`
- }
- type DirectoryListResp {
- List []DirectoryResp `json:"list"`
- Total int64 `json:"total"`
- }
- type CreateKeyReq {
- Name string `json:"name"`
- }
- type UpdateKeyReq {
- Id int64 `json:"id"`
- Status string `json:"status"`
- }
- type KeyIdReq {
- Id int64 `json:"id"`
- }
- type KeyResp {
- Id int64 `json:"id"`
- Iden string `json:"iden"`
- Name string `json:"name"`
- Content string `json:"content"`
- Status string `json:"status"`
- CreateAt string `json:"createAt"`
- }
- type ListKeysReq {
- Page int64 `json:"page,optional"`
- PageSize int64 `json:"pageSize,optional"`
- Name string `json:"name,optional"`
- Status string `json:"status,optional"`
- }
- type KeyListResp {
- List []KeyResp `json:"list"`
- Total int64 `json:"total"`
- }
- type CreateServiceReq {
- Id int64 `json:"id,optional"`
- Name string `json:"name,optional"`
- Ip string `json:"ip,optional"`
- Port int64 `json:"port,optional"`
- Iden string `json:"iden,optional"`
- KeyIden string `json:"keyIden,optional"`
- KeyAlgo string `json:"keyAlgo,optional"`
- Status string `json:"status,optional"`
- Directories []string `json:"directories,optional"`
- }
- type UpdateServiceReq {
- Id int64 `path:"id"`
- Name string `json:"name,optional"`
- Ip string `json:"ip,optional"`
- Port int64 `json:"port,optional"`
- Iden string `json:"iden,optional"`
- KeyIden string `json:"keyIden,optional"`
- KeyAlgo string `json:"keyAlgo,optional"`
- Status string `json:"status,optional"`
- }
- type ServiceIdReq {
- Id int64 `path:"id"`
- }
- type ServiceResp {
- Id int64 `json:"id"`
- Name string `json:"name"`
- Ip string `json:"ip"`
- Port int64 `json:"port"`
- Iden string `json:"iden"`
- KeyIden string `json:"keyIden"`
- KeyAlgo string `json:"keyAlgo"`
- Status string `json:"status"`
- CreateAt string `json:"createAt"`
- // 挂载通知失败等非致命警告,前端黄色提示
- MountWarning string `json:"mountWarning,optional"`
- }
- type ListServiceReq {
- Page int64 `form:"page,optional"`
- PageSize int64 `form:"pageSize,optional"`
- }
- type ServiceListResp {
- List []ServiceResp `json:"list"`
- Total int64 `json:"total"`
- }
- // 本地目录懒加载(udeServer 所在 Linux 主机文件系统,只列目录不列文件)
- type ListDirChildrenReq {
- Ip string `form:"ip"` // 目标 Linux 主机 IP
- Port string `form:"port"` // 目标主机 /api/v1 端口
- Path string `form:"path"` // 空或 "/" 表示根目录
- }
- type LocalDirNode {
- Name string `json:"name"` // 目录名,如 "usr"
- Path string `json:"path"` // 完整绝对路径,如 "/usr"
- IsDir bool `json:"isDir"` // 恒 true
- HasChildren bool `json:"hasChildren"` // 是否含子目录(前端据此决定是否显示展开箭头)
- }
- type DirChildrenResp {
- Nodes []LocalDirNode `json:"nodes"`
- }
- // ===== 审计日志(移植自 sdf-serve systemLog 模块)=====
- type SystemLog {
- Id int64 `json:"id"` // 主键
- Iden string `json:"iden"` // 日志标识
- TraceId string `json:"traceId"` // 全链路TraceId
- SpanId string `json:"spanId"` // 子链路SpanId
- ParentSpanId string `json:"parentSpanId"` // 父SpanId
- Type int `json:"type"` // 日志类型:1.系统日志;2.接口日志
- ServiceName string `json:"serviceName"` // 所属服务名称/模块名称
- UriPath string `json:"uriPath"` // 接口请求路径
- HttpMethod string `json:"httpMethod"` // 请求方法
- Method string `json:"method"` // 业务方法名
- Level string `json:"level"` // 日志级别
- AppKey string `json:"appKey"` // 调用接口应用标识
- UserId string `json:"userId"` // 系统用户ID
- UserName string `json:"userName"` // 系统用户名
- ClientIp string `json:"clientIp"` // 客户端IP
- RequestHeader string `json:"requestHeader"` // 请求头
- RequestBodyDigest string `json:"requestBodyDigest"` // 请求体摘要
- RequestBodyFileKey string `json:"requestBodyFileKey"` // 请求体FileKey
- ResponseCode int64 `json:"responseCode"` // 响应业务码
- ResponseBodyDigest string `json:"responseBodyDigest"` // 响应体摘要
- ResponseBodyFileKey string `json:"responseBodyFileKey"` // 响应体FileKey
- ErrorMsg string `json:"errorMsg"` // 错误信息
- DurationMs int64 `json:"durationMs"` // 请求耗时
- CreatedAt string `json:"createdAt"` // 日志写入时间
- Hmac string `json:"hmac"` // Hmac值
- AuditStatus int `json:"auditStatus"` // 审计状态:1.未审计;2.审计通过;3.审计异常
- }
- type SystemLogListReq {
- Iden string `json:"iden,optional"` // 日志标识
- Type int64 `json:"type,optional"` // 日志类型
- UserName string `json:"userName,optional"` // 用户名称
- AppKey string `json:"appKey,optional"` // 应用标识
- UriPath string `json:"uriPath,optional"` // 接口请求路径
- HttpMethod string `json:"httpMethod,optional"` // 请求方式
- CreatedStartTime string `json:"createdStartTime,optional"` // 写入开始时间
- CreatedEndTime string `json:"createdEndTime,optional"` // 写入结束时间
- ClientIp string `json:"clientIp,optional"` // 客户端IP
- ErrorMsg string `json:"errorMsg,optional"` // 错误信息
- AuditStatus string `json:"auditStatus,optional"` // 审计状态
- Page int64 `json:"page,optional"`
- PageSize int64 `json:"pageSize,optional"`
- }
- type SystemLogListResp {
- Total int64 `json:"total"`
- Logs []SystemLog `json:"logs"`
- }
- type SystemLogDetailReq {
- Iden string `json:"iden"`
- }
- type SystemLogDetailResp {
- SystemLog
- }
- type SystemLogAuditReq {
- Idens []string `json:"idens"`
- }
- type AuditResult {
- LogIden string `json:"logIden"`
- Valid bool `json:"valid"`
- Reason string `json:"reason"`
- }
- type SystemLogAuditResp {
- TotalCount int64 `json:"totalCount"`
- ValidCount int64 `json:"validCount"`
- InValidCount int64 `json:"inValidCount"`
- AuditResults []AuditResult `json:"auditResults"`
- }
- type SystemLogArchiveReq {
- Name string `json:"name"` // 归档任务名称
- Ids []int64 `json:"ids,optional"` // 日志ID集合
- StartDate string `json:"startDate,optional"` // 归档开始日期
- EndDate string `json:"endDate,optional"` // 归档结束日期
- }
- type SystemLogArchiveResp {
- Count int `json:"count"`
- }
- type SystemLogLinkReq {
- TraceId string `json:"traceId"`
- }
- type SystemLogLinkResp {
- LogLinks []SystemLog `json:"logLinks"`
- }
- type LogArchive {
- Id int64 `json:"id"`
- ArchiveName string `json:"archiveName"`
- RecordCount int64 `json:"recordCount"`
- ArchiveFileKey string `json:"archiveFileKey"`
- ArchiveMode int `json:"archiveMode"` // 归档模式:1.手动,2.自动
- BatchSize int `json:"batchSize"`
- ArchivedBy string `json:"archivedBy"`
- ArchivedAt string `json:"archivedAt"`
- }
- type LogArchiveListReq {
- ArchiveName string `json:"archiveName,optional"`
- ArchivedBy string `json:"archivedBy,optional"`
- ArchivedStartTime string `json:"archivedStartTime,optional"`
- ArchivedEndTime string `json:"archivedEndTime,optional"`
- Page int64 `json:"page,optional"`
- PageSize int64 `json:"pageSize,optional"`
- }
- type LogArchiveListResp {
- Total int64 `json:"total"`
- LogArchives []LogArchive `json:"logArchives"`
- }
- type LogArchiveDownloadReq {
- Ids []int64 `json:"ids"`
- }
- type LogArchiveRestoreReq {
- Ids []int64 `json:"ids"`
- }
- type LogArchiveRestoreResp {
- RestoreMsg string `json:"restoreMsg"`
- }
- type LogRestore {
- Id int64 `json:"id"`
- ArchiveId int64 `json:"archiveId"`
- RestoreStatus int `json:"restoreStatus"` // 1.成功,2.失败,3.恢复中
- RestoreMessage string `json:"restoreMessage"`
- RestoredBy string `json:"restoredBy"`
- RestoredAt string `json:"restoredAt"`
- }
- type LogRestoreListReq {
- RestoreStatus int64 `json:"restoreStatus,optional"`
- RestoreMessage string `json:"restoreMessage,optional"`
- Page int64 `json:"page,optional"`
- PageSize int64 `json:"pageSize,optional"`
- }
- type LogRestoreListResp {
- Total int64 `json:"total"`
- LogRestores []LogRestore `json:"logRestores"`
- }
- @server (
- prefix: /api/v1/systemlog
- group: systemlog
- )
- // 审计日志管理模块
- service udeServer-api {
- @doc "日志分页列表"
- @handler LogListHandler
- post /list (SystemLogListReq) returns (SystemLogListResp)
- @doc "日志详情"
- @handler LogDetailHandler
- post /detail (SystemLogDetailReq) returns (SystemLogDetailResp)
- @doc "日志审计(校验Hmac防篡改)"
- @handler LogAuditHandler
- post /audit (SystemLogAuditReq) returns (SystemLogAuditResp)
- @doc "日志归档"
- @handler LogArchiveHandler
- post /archive (SystemLogArchiveReq) returns (SystemLogArchiveResp)
- @doc "查看完整链路"
- @handler LogLinkHandler
- post /link (SystemLogLinkReq) returns (SystemLogLinkResp)
- }
- @server (
- prefix: /api/v1/logarchive
- group: systemlog
- )
- // 归档管理模块
- service udeServer-api {
- @doc "归档列表"
- @handler LogArchiveListHandler
- post /list (LogArchiveListReq) returns (LogArchiveListResp)
- @doc "归档打包下载(zip)"
- @handler LogArchiveDownloadHandler
- post /download (LogArchiveDownloadReq)
- @doc "归档恢复"
- @handler LogArchiveRestoreHandler
- post /restore (LogArchiveRestoreReq) returns (LogArchiveRestoreResp)
- }
- @server (
- prefix: /api/v1/logrestore
- group: systemlog
- )
- // 恢复记录模块
- service udeServer-api {
- @doc "恢复记录列表"
- @handler LogRestoreListHandler
- post /list (LogRestoreListReq) returns (LogRestoreListResp)
- }
- @server (
- prefix: /api/v1
- )
- service udeServer-api {
- @handler UdeServerHandler
- get /from/:name (Request) returns (Response)
- @handler DbPingHandler
- get /db/ping returns (DbPingResponse)
- @handler CreateDirectoryHandler
- post /directories (CreateDirectoryReq) returns (DirectoryResp)
- @handler ListDirectoriesHandler
- get /directories (ListDirectoryReq) returns (DirectoryListResp)
- @handler GetDirectoryHandler
- get /directories/:id (DirectoryIdReq) returns (DirectoryResp)
- @handler UpdateDirectoryHandler
- put /directories/:id (UpdateDirectoryReq) returns (DirectoryResp)
- @handler DeleteDirectoryHandler
- delete /directories/:id (DirectoryIdReq) returns (DeleteResp)
- @handler CreateKeyHandler
- post /keys/create (CreateKeyReq) returns (KeyResp)
- @handler ListKeysHandler
- post /keys/list (ListKeysReq) returns (KeyListResp)
- @handler GetKeyHandler
- post /keys/detail (KeyIdReq) returns (KeyResp)
- @handler UpdateKeyHandler
- post /keys/update (UpdateKeyReq) returns (KeyResp)
- @handler DeleteKeyHandler
- post /keys/delete (KeyIdReq) returns (DeleteResp)
- @handler CreateServiceHandler
- post /services (CreateServiceReq) returns (ServiceResp)
- @handler ListServicesHandler
- get /services (ListServiceReq) returns (ServiceListResp)
- @handler GetServiceHandler
- get /services/:id (ServiceIdReq) returns (ServiceResp)
- @handler UpdateServiceHandler
- put /services/:id (UpdateServiceReq) returns (ServiceResp)
- @handler DeleteServiceHandler
- delete /services/:id (ServiceIdReq) returns (DeleteResp)
- @handler BrushServiceHandler
- post /services/:id/brush (ServiceIdReq) returns (DeleteResp)
- @handler ListDirChildrenHandler
- get /dirs/children (ListDirChildrenReq) returns (DirChildrenResp)
- }
|