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"` // 联动卸载失败等非致命警告(删除本身已成功),前端弹黄色警告; // 目录/密钥删除等其他共用本结构体的接口不填此字段。 UnmountWarning string `json:"unmountWarning,optional"` } 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"` // 一键刷库:0=否(默认),1=创建后自动下发刷库 Brush int64 `json:"brush,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"` // 一键刷库:0=否(默认),1=是。编辑只落库改配置,不追溯触发刷库(刷库编排仅在创建流程) Brush int64 `json:"brush,optional"` // 编辑时全量提交保护目录列表(nil=未提交不动目录;空数组=清空;非空=全量重写) Directories []string `json:"directories,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"` // 挂载状态: mounted=已挂载 unmounted=未挂载 failed=挂载失败 MountStatus string `json:"mountStatus,optional"` // 挂载通知失败等非致命警告,前端黄色提示 MountWarning string `json:"mountWarning,optional"` // 一键刷库配置:0=否(默认),1=是 Brush int64 `json:"brush"` } 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"` // 空或 "/" 表示根目录 Iden string `form:"iden,optional"` // 接入标识:转发外挂时作为 X-TOKEN 头的值;外挂 /path/lists 已免鉴权,未选接入标识(空值)也放行 } 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) // 启用服务联动挂载:逐保护目录调外挂 /api/fuseMount,成功后 status=启用、mount_status=mounted @handler MountServiceHandler post /services/:id/mount (ServiceIdReq) returns (ServiceResp) // 停用服务联动卸载:逐保护目录调外挂 /api/fuseUnMount,成功后 status=停用、mount_status=unmounted @handler UnmountServiceHandler post /services/:id/unmount (ServiceIdReq) returns (ServiceResp) @handler ListDirChildrenHandler get /dirs/children (ListDirChildrenReq) returns (DirChildrenResp) } // ===== 应用凭证(移植自 sdf-serve applicationCredentials 模块)===== type ApplicationCredentials { Id int64 `json:"id"` CredIden string `json:"credIden"` Name string `json:"name"` ApiKey string `json:"apiKey"` ApiSecret string `json:"apiSecret"` // 掩码后的密钥,原文走下发接口 Status int `json:"status"` // 启用状态:1.启用;2.禁用 Description string `json:"description"` CreatedBy string `json:"createdBy"` CreatedAt string `json:"createdAt"` UpdatedBy string `json:"updatedBy"` UpdatedAt string `json:"updatedAt"` } type ApplicationCredentialsAddReq { Name string `json:"name"` // 应用名称 Status int `json:"status,optional"` // 应用状态(1启用,2禁用),缺省启用 Description string `json:"description,optional"` // 应用描述 } type ApplicationCredentialsAddResp { Iden string `json:"iden"` // 应用凭证标识 } type ApplicationCredentialsDeleteReq { Id int64 `json:"id"` } type ApplicationCredentialsDeleteResp { Iden string `json:"iden"` // 应用凭证标识 } type ApplicationCredentialsDistributeReq { Id int64 `json:"id"` } type ApplicationCredentialsDistributeResp { ApiSecret string `json:"apiSecret"` // 应用凭证密钥(明文,仅下发接口返回) } type ApplicationCredentialsResetReq { Id int64 `json:"id"` } type ApplicationCredentialsResetResp { Iden string `json:"iden"` // 应用凭证标识 } type ApplicationCredentialsUpdateStatusReq { Id int64 `json:"id"` } type ApplicationCredentialsUpdateStatusResp { Iden string `json:"iden"` // 应用凭证标识 } type ApplicationListReq { Status int64 `json:"status,optional"` // 启用状态筛选 CredIden string `json:"credIden,optional"` // 应用凭证标识筛选 Name string `json:"name,optional"` // 应用名称模糊筛选 Page int64 `json:"page,optional"` PageSize int64 `json:"pageSize,optional"` } type ApplicationListResp { Total int64 `json:"total"` ApplicationLists []ApplicationCredentials `json:"applicationLists"` } @server ( prefix: /api/v1/applicationCredentials group: application ) // 应用凭证管理模块 service udeServer-api { @doc "添加应用凭证" @handler AddApplicationHandler post /addApplication (ApplicationCredentialsAddReq) returns (ApplicationCredentialsAddResp) @doc "应用凭证列表" @handler ApplicationListHandler post /applicationList (ApplicationListReq) returns (ApplicationListResp) @doc "删除应用凭证" @handler DeleteApplicationHandler post /deleteApplication (ApplicationCredentialsDeleteReq) returns (ApplicationCredentialsDeleteResp) @doc "下发应用凭证密钥" @handler DistributeApiSecretHandler post /distributeApiSecret (ApplicationCredentialsDistributeReq) returns (ApplicationCredentialsDistributeResp) @doc "重置应用凭证密钥" @handler ResetApplicationHandler post /resetApplication (ApplicationCredentialsResetReq) returns (ApplicationCredentialsResetResp) @doc "切换应用凭证状态(启用/禁用互换)" @handler UpdateApplicationStatusHandler post /updateApplicationStatus (ApplicationCredentialsUpdateStatusReq) returns (ApplicationCredentialsUpdateStatusResp) } // ===== 运维诊断(移植自 sdf-serve ops 模块,WebSocket)===== type WSRequest { Action string `json:"action"` // 命令类型:ping;traceroute;telnet Target string `json:"target"` // IP或域名,ping/traceroute 用 Count int `json:"count,optional"` // ping 次数,默认 4 Host string `json:"host"` // telnet host Port int `json:"port"` // telnet port MaxHops int `json:"maxHops,optional"` // traceroute 最大跳数,默认 30 } type WSResponse { Action string `json:"action"` // 命令类型 Status string `json:"status"` // 状态:running;done;error Output string `json:"output"` // 输出信息 } @server ( prefix: /api/v1 group: ops ) // 运维诊断模块(WebSocket,先 HTTP 升级再以 WSRequest/WSResponse 消息交互) service udeServer-api { @doc "WebSocket 运维诊断(ping/traceroute/telnet)" @handler OpsHandler get /ws/ops (WSRequest) returns (WSResponse) } // ===== 系统配置(移植自 sdf-serve applicationConfig 模块,操作 t_config)===== type Config { Id int64 `json:"id"` // 主键 ConfigItem string `json:"configItem"` // 配置项 ConfigValue string `json:"configValue"` // 配置值 EditFlag int64 `json:"editFlag"` // 是否可编辑:1=禁止编辑(配置项名锁定);2=允许编辑 Description string `json:"descritpion"` // 描述(字段名 descritpion 沿袭 sdf 契约) UpdatedBy string `json:"updatedBy"` // 更新人 UpdatedAt string `json:"updatedAt"` // 更新时间 } type ConfigListReq { ConfigItem string `json:"configItem,optional"` // 配置项精确筛选 Description string `json:"description,optional"` // 描述模糊筛选 Page int64 `json:"page,optional"` PageSize int64 `json:"pageSize,optional"` } type ConfigListResp { Total int64 `json:"total"` Configs []Config `json:"configs"` } type ConfigAddReq { ConfigItem string `json:"configItem"` // 配置项 ConfigValue string `json:"configValue"` // 配置值 Description string `json:"description,optional"` // 描述 } type ConfigAddResp { Id int64 `json:"id"` } type ConfigDeleteReq { Id int64 `json:"id"` } type ConfigDeleteResp { Id int64 `json:"id"` } type ConfigUpdateReq { Id int64 `json:"id"` // 配置ID ConfigItem string `json:"configItem"` // 配置项 ConfigValue string `json:"configValue"` // 配置值 Description string `json:"description,optional"` // 描述 } type ConfigUpdateResp { Id int64 `json:"id"` } // ===== 自定义页面(移植自 sdf-serve customPage 模块,title/logo 内存缓存)===== type PageCache { Name string `json:"name"` // 页面标题 Logo string `json:"logo"` // logo 路径或编码 } type SetCacheReq { Name string `json:"name"` // 页面标题 Logo string `json:"logo"` // logo } type SetCacheResp { Name string `json:"name"` // 页面标题 Logo string `json:"logo"` // logo } type GetCacheResp { Name string `json:"name"` // 页面标题 Logo string `json:"logo"` // logo } type ClearCacheResp { Name string `json:"name"` // 页面标题(复位后为空) Logo string `json:"logo"` // logo(复位后为空) } @server ( prefix: /api/v1/applicationConfig group: applicationconfig ) // 系统配置管理模块 service udeServer-api { @doc "添加配置" @handler AddConfigHandler post /addConfig (ConfigAddReq) returns (ConfigAddResp) @doc "配置分页列表" @handler ConfigListHandler post /configList (ConfigListReq) returns (ConfigListResp) @doc "删除配置" @handler DeleteConfigHandler post /deleteConfig (ConfigDeleteReq) returns (ConfigDeleteResp) @doc "更新配置(默认配置 edit_flag=1 不允许改配置项名)" @handler UpdateConfigHandler post /updateConfig (ConfigUpdateReq) returns (ConfigUpdateResp) } @server ( prefix: /api/v1/customPage group: custompage ) // 自定义页面模块 service udeServer-api { @doc "设置自定义页面信息(标题/logo)" @handler SetCacheHandler post /set (SetCacheReq) returns (SetCacheResp) @doc "获取自定义页面信息" @handler GetCacheHandler get /get returns (GetCacheResp) @doc "复位自定义页面信息" @handler ClearCacheHandler post /clear returns (ClearCacheResp) }