171 lines
10 KiB
Go
171 lines
10 KiB
Go
|
|
package api_feature
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"cid/consts/api-feature"
|
|||
|
|
entity "cid/model/entity/dict"
|
|||
|
|
|
|||
|
|
"gitea.com/red-future/common/beans"
|
|||
|
|
"github.com/gogf/gf/v2/frame/g"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// CreateDatasourcePlatformReq 创建数据源平台请求
|
|||
|
|
type CreateDatasourcePlatformReq struct {
|
|||
|
|
g.Meta `path:"/createDatasourcePlatform" method:"post" tags:"数据源平台管理" summary:"创建数据源平台" dc:"创建新的数据源平台配置"`
|
|||
|
|
PlatformCode string `json:"platformCode" v:"required" dc:"平台编码(唯一标识)"`
|
|||
|
|
PlatformName string `json:"platformName" v:"required" dc:"平台名称"`
|
|||
|
|
Description string `json:"description" dc:"平台描述"`
|
|||
|
|
Status api_feature.PlatformStatus `json:"status" dc:"平台状态" d:"ACTIVE"`
|
|||
|
|
ApiBaseUrl string `json:"apiBaseUrl" dc:"API基础地址"`
|
|||
|
|
AuthType string `json:"authType" v:"required|in:TOKEN,API_KEY,OAUTH2,BASIC" dc:"认证类型: TOKEN/API_KEY/OAUTH2/BASIC"`
|
|||
|
|
Token string `json:"token" dc:"认证token/密钥"`
|
|||
|
|
ApiKey string `json:"apiKey" dc:"API Key"`
|
|||
|
|
ClientId string `json:"clientId" dc:"OAuth2 Client ID"`
|
|||
|
|
ClientSecret string `json:"clientSecret" dc:"OAuth2 Client Secret"`
|
|||
|
|
RateLimitPerMinute int `json:"rateLimitPerMinute" dc:"每分钟请求限制" d:"60"`
|
|||
|
|
RateLimitPerHour int `json:"rateLimitPerHour" dc:"每小时请求限制" d:"1000"`
|
|||
|
|
ConcurrencyLimit int `json:"concurrencyLimit" dc:"并发连接限制" d:"10"`
|
|||
|
|
RequestTimeoutMs int `json:"requestTimeoutMs" dc:"请求超时时间(毫秒)" d:"30000"`
|
|||
|
|
MaxRetries int `json:"maxRetries" dc:"最大重试次数" d:"3"`
|
|||
|
|
RetryDelayMs int `json:"retryDelayMs" dc:"重试延迟(毫秒)" d:"1000"`
|
|||
|
|
CreatedBy string `json:"createdBy" v:"required" dc:"创建人"`
|
|||
|
|
CreatedAt string `json:"createdAt" v:"required" dc:"创建时间"`
|
|||
|
|
UpdatedBy string `json:"updatedBy" v:"required" dc:"修改人"`
|
|||
|
|
UpdatedAt string `json:"updatedAt" v:"required" dc:"修改人"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateDatasourcePlatformRes 创建数据源平台响应
|
|||
|
|
type CreateDatasourcePlatformRes struct {
|
|||
|
|
Id int64 `json:"id" dc:"平台ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListDatasourcePlatformReq 获取数据源平台列表请求
|
|||
|
|
type ListDatasourcePlatformReq struct {
|
|||
|
|
g.Meta `path:"/listDatasourcePlatforms" method:"get" tags:"数据源平台管理" summary:"获取数据源平台列表" dc:"分页查询数据源平台列表"`
|
|||
|
|
*beans.Page
|
|||
|
|
PlatformCode string `json:"platformCode" dc:"平台编码"`
|
|||
|
|
PlatformName string `json:"platformName" dc:"平台名称"`
|
|||
|
|
Status api_feature.PlatformStatus `json:"status" dc:"平台状态"`
|
|||
|
|
AuthType string `json:"authType" dc:"认证类型"`
|
|||
|
|
Keyword string `json:"keyword" dc:"关键字(搜索平台名称或编码)"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListDatasourcePlatformRes 获取数据源平台列表响应
|
|||
|
|
type ListDatasourcePlatformRes struct {
|
|||
|
|
List []DatasourcePlatformItem `json:"list" dc:"平台列表"`
|
|||
|
|
Total int `json:"total" dc:"总数"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type DatasourcePlatformItem struct {
|
|||
|
|
Id int64 `json:"id,string"`
|
|||
|
|
PlatformCode string `json:"platformCode"`
|
|||
|
|
PlatformName string `json:"platformName"`
|
|||
|
|
Description string `json:"description"`
|
|||
|
|
Status api_feature.PlatformStatus `json:"status"`
|
|||
|
|
StatusName string `json:"statusName"`
|
|||
|
|
ApiBaseUrl string `json:"apiBaseUrl"`
|
|||
|
|
AuthType string `json:"authType"`
|
|||
|
|
AuthTypeName string `json:"authTypeName"`
|
|||
|
|
RateLimitPerMinute int `json:"rateLimitPerMinute"`
|
|||
|
|
RateLimitPerHour int `json:"rateLimitPerHour"`
|
|||
|
|
ConcurrencyLimit int `json:"concurrencyLimit"`
|
|||
|
|
RequestTimeoutMs int `json:"requestTimeoutMs"`
|
|||
|
|
MaxRetries int `json:"maxRetries"`
|
|||
|
|
RetryDelayMs int `json:"retryDelayMs"`
|
|||
|
|
CreatedBy string `json:"createdBy"`
|
|||
|
|
CreatedAt int64 `json:"createdAt"`
|
|||
|
|
UpdatedBy string `json:"updatedBy"`
|
|||
|
|
UpdatedAt int64 `json:"updatedAt"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetDatasourcePlatformReq 获取数据源平台详情请求
|
|||
|
|
type GetDatasourcePlatformReq struct {
|
|||
|
|
g.Meta `path:"/getDatasourcePlatform" method:"get" tags:"数据源平台管理" summary:"获取数据源平台详情" dc:"获取数据源平台详情"`
|
|||
|
|
Id int64 `json:"id" v:"required" dc:"平台ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetDatasourcePlatformRes 获取数据源平台详情响应
|
|||
|
|
type GetDatasourcePlatformRes struct {
|
|||
|
|
*entity.DatasourcePlatform
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateDatasourcePlatformReq 更新数据源平台请求
|
|||
|
|
type UpdateDatasourcePlatformReq struct {
|
|||
|
|
g.Meta `path:"/updateDatasourcePlatform" method:"put" tags:"数据源平台管理" summary:"更新数据源平台" dc:"更新数据源平台配置"`
|
|||
|
|
Id int64 `json:"id" v:"required" dc:"平台ID"`
|
|||
|
|
PlatformCode string `json:"platformCode" dc:"平台编码"`
|
|||
|
|
PlatformName string `json:"platformName" dc:"平台名称"`
|
|||
|
|
Description string `json:"description" dc:"平台描述"`
|
|||
|
|
Status api_feature.PlatformStatus `json:"status,omitempty" dc:"平台状态"`
|
|||
|
|
ApiBaseUrl string `json:"apiBaseUrl" dc:"API基础地址"`
|
|||
|
|
AuthType string `json:"authType" dc:"认证类型"`
|
|||
|
|
Token string `json:"token" dc:"认证token/密钥"`
|
|||
|
|
ApiKey string `json:"apiKey" dc:"API Key"`
|
|||
|
|
ClientId string `json:"clientId" dc:"OAuth2 Client ID"`
|
|||
|
|
ClientSecret string `json:"clientSecret" dc:"OAuth2 Client Secret"`
|
|||
|
|
RateLimitPerMinute int `json:"rateLimitPerMinute" dc:"每分钟请求限制"`
|
|||
|
|
RateLimitPerHour int `json:"rateLimitPerHour" dc:"每小时请求限制"`
|
|||
|
|
ConcurrencyLimit int `json:"concurrencyLimit" dc:"并发连接限制"`
|
|||
|
|
RequestTimeoutMs int `json:"requestTimeoutMs" dc:"请求超时时间(毫秒)"`
|
|||
|
|
MaxRetries int `json:"maxRetries" dc:"最大重试次数"`
|
|||
|
|
RetryDelayMs int `json:"retryDelayMs" dc:"重试延迟(毫秒)"`
|
|||
|
|
UpdatedBy string `json:"updatedBy" v:"required" dc:"更新人"`
|
|||
|
|
UpdatedAt string `json:"updatedAt" v:"required" dc:"更新时间"`
|
|||
|
|
Version string `json:"version" v:"required" dc:"版本"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DeleteDatasourcePlatformReq 删除数据源平台请求
|
|||
|
|
type DeleteDatasourcePlatformReq struct {
|
|||
|
|
g.Meta `path:"/deleteDatasourcePlatform" method:"delete" tags:"数据源平台管理" summary:"删除数据源平台" dc:"删除数据源平台"`
|
|||
|
|
Id int64 `json:"id" v:"required" dc:"平台ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateDatasourcePlatformStatusReq 更新数据源平台状态请求
|
|||
|
|
type UpdateDatasourcePlatformStatusReq struct {
|
|||
|
|
g.Meta `path:"/updateDatasourcePlatformStatus" method:"put" tags:"数据源平台管理" summary:"更新数据源平台状态" dc:"更新数据源平台状态"`
|
|||
|
|
Id int64 `json:"id" v:"required" dc:"平台ID"`
|
|||
|
|
Status api_feature.PlatformStatus `json:"status" v:"required|in:ACTIVE,INACTIVE" dc:"状态:ACTIVE启用/INACTIVE停用"`
|
|||
|
|
UpdatedBy string `json:"updatedBy" v:"required" dc:"更新人"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 以下是几个额外的实用API接口
|
|||
|
|
|
|||
|
|
// GetPlatformByCodeReq 根据平台编码获取平台信息请求
|
|||
|
|
type GetPlatformByCodeReq struct {
|
|||
|
|
g.Meta `path:"/getPlatformByCode" method:"get" tags:"数据源平台管理" summary:"根据编码获取平台信息" dc:"根据平台编码获取平台配置信息"`
|
|||
|
|
PlatformCode string `json:"platformCode" v:"required" dc:"平台编码"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetPlatformByCodeRes 根据平台编码获取平台信息响应
|
|||
|
|
type GetPlatformByCodeRes struct {
|
|||
|
|
*entity.DatasourcePlatform
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TestPlatformConnectionReq 测试平台连接请求
|
|||
|
|
type TestPlatformConnectionReq struct {
|
|||
|
|
g.Meta `path:"/testPlatformConnection" method:"post" tags:"数据源平台管理" summary:"测试平台连接" dc:"测试数据源平台连接配置"`
|
|||
|
|
Id int64 `json:"id" v:"required" dc:"平台ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TestPlatformConnectionRes 测试平台连接响应
|
|||
|
|
type TestPlatformConnectionRes struct {
|
|||
|
|
Success bool `json:"success" dc:"连接是否成功"`
|
|||
|
|
Message string `json:"message" dc:"连接结果消息"`
|
|||
|
|
LatencyMs int `json:"latencyMs" dc:"连接延迟(毫秒)"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetPlatformStatisticsReq 获取平台统计信息请求
|
|||
|
|
type GetPlatformStatisticsReq struct {
|
|||
|
|
g.Meta `path:"/getPlatformStatistics" method:"get" tags:"数据源平台管理" summary:"获取平台统计信息" dc:"获取数据源平台统计信息"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetPlatformStatisticsRes 获取平台统计信息响应
|
|||
|
|
type GetPlatformStatisticsRes struct {
|
|||
|
|
TotalPlatforms int `json:"totalPlatforms" dc:"总平台数"`
|
|||
|
|
ActivePlatforms int `json:"activePlatforms" dc:"启用平台数"`
|
|||
|
|
InactivePlatforms int `json:"inactivePlatforms" dc:"停用平台数"`
|
|||
|
|
TokenAuthPlatforms int `json:"tokenAuthPlatforms" dc:"TOKEN认证平台数"`
|
|||
|
|
ApiKeyAuthPlatforms int `json:"apiKeyAuthPlatforms" dc:"API_KEY认证平台数"`
|
|||
|
|
OAuth2AuthPlatforms int `json:"oauth2AuthPlatforms" dc:"OAUTH2认证平台数"`
|
|||
|
|
BasicAuthPlatforms int `json:"basicAuthPlatforms" dc:"BASIC认证平台数"`
|
|||
|
|
}
|