Documentation
¶
Index ¶
- Constants
- func GetOperationLogBodyDumpMiddleware(config OperationLogMiddlewareConfig) echo.MiddlewareFunc
- type AccountInfo
- type ListDBAccountReply
- type OperationLogMiddlewareConfig
- type SQLEAuditResultSummary
- type SqlWorkbenchService
- func (sqlWorkbenchService *SqlWorkbenchService) AuditMiddleware() echo.MiddlewareFunc
- func (sqlWorkbenchService *SqlWorkbenchService) GetOdcProxyTarget() ([]*middleware.ProxyTarget, error)
- func (sqlWorkbenchService *SqlWorkbenchService) GetRootUri() string
- func (sqlWorkbenchService *SqlWorkbenchService) IsConfigured() bool
- func (sqlWorkbenchService *SqlWorkbenchService) Login() echo.MiddlewareFunc
- func (sqlWorkbenchService *SqlWorkbenchService) ResetDbServiceByAuth(ctx context.Context, activeDBServices []*biz.DBService, userId string) ([]*biz.DBService, error)
- func (sqlWorkbenchService *SqlWorkbenchService) SupportDBType(dbType pkgConst.DBType) bool
- type StreamExecuteData
- type StreamExecuteResponse
- type StreamExecuteRule
- type StreamExecuteSQLItem
- type StreamExecuteSQLTuple
- type StreamExecuteViolation
- type TempDBAccount
Constants ¶
View Source
const ( ODCSessionCookieName = "JSESSIONID" ODCXsrfTokenCookieName = "XSRF-TOKEN" )
ODC 会话相关的 cookie 名称
View Source
const INDIVIDUAL_SPACE = 4
View Source
const SQL_WORKBENCH_DEFAULT_PASSWORD = "DMS123__"
View Source
const SQL_WORKBENCH_PREFIX = "DMS-"
View Source
const SQL_WORKBENCH_REAL_PASSWORD = "DMS123__@"
View Source
const SQL_WORKBENCH_URL = "/odc_query"
Variables ¶
This section is empty.
Functions ¶
func GetOperationLogBodyDumpMiddleware ¶
func GetOperationLogBodyDumpMiddleware(config OperationLogMiddlewareConfig) echo.MiddlewareFunc
GetOperationLogBodyDumpMiddleware 返回用于记录操作日志的 BodyDump 中间件
Types ¶
type AccountInfo ¶
type AccountInfo struct {
User string `json:"user"`
Hostname string `json:"hostname"`
Password string `json:"password"`
}
AccountInfo 账号信息
type ListDBAccountReply ¶
type ListDBAccountReply struct {
Data []*TempDBAccount `json:"data"`
Code int `json:"code"`
Message string `json:"message"`
}
ListDBAccountReply 数据库账号列表响应
type OperationLogMiddlewareConfig ¶
type OperationLogMiddlewareConfig struct {
CbOperationLogUsecase *biz.CbOperationLogUsecase
DBServiceUsecase *biz.DBServiceUsecase
SqlWorkbenchService *SqlWorkbenchService
}
OperationLogMiddlewareConfig 配置操作日志中间件
type SQLEAuditResultSummary ¶
type SQLEAuditResultSummary struct {
AuditLevel string `json:"audit_level"`
Score int32 `json:"score"`
PassRate float64 `json:"pass_rate"`
}
SQLEAuditResultSummary SQLE 审核结果汇总
type SqlWorkbenchService ¶
type SqlWorkbenchService struct {
// contains filtered or unexported fields
}
func NewAndInitSqlWorkbenchService ¶
func NewAndInitSqlWorkbenchService(logger utilLog.Logger, opts *conf.DMSOptions) (*SqlWorkbenchService, error)
func (*SqlWorkbenchService) AuditMiddleware ¶
func (sqlWorkbenchService *SqlWorkbenchService) AuditMiddleware() echo.MiddlewareFunc
AuditMiddleware 拦截工作台odc请求进行加工
func (*SqlWorkbenchService) GetOdcProxyTarget ¶
func (sqlWorkbenchService *SqlWorkbenchService) GetOdcProxyTarget() ([]*middleware.ProxyTarget, error)
func (*SqlWorkbenchService) GetRootUri ¶
func (sqlWorkbenchService *SqlWorkbenchService) GetRootUri() string
func (*SqlWorkbenchService) IsConfigured ¶
func (sqlWorkbenchService *SqlWorkbenchService) IsConfigured() bool
func (*SqlWorkbenchService) Login ¶
func (sqlWorkbenchService *SqlWorkbenchService) Login() echo.MiddlewareFunc
func (*SqlWorkbenchService) ResetDbServiceByAuth ¶
func (*SqlWorkbenchService) SupportDBType ¶
func (sqlWorkbenchService *SqlWorkbenchService) SupportDBType(dbType pkgConst.DBType) bool
type StreamExecuteData ¶
type StreamExecuteData struct {
ApprovalRequired bool `json:"approvalRequired"`
LogicalSQL bool `json:"logicalSql"`
RequestID *string `json:"requestId"`
SQLs []StreamExecuteSQLItem `json:"sqls"`
ViolatedRules []interface{} `json:"violatedRules"`
}
StreamExecuteData streamExecute 响应中的 data 字段
type StreamExecuteResponse ¶
type StreamExecuteResponse struct {
Data StreamExecuteData `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
}
StreamExecuteResponse streamExecute 接口响应结构
type StreamExecuteRule ¶
type StreamExecuteRule struct {
AppliedDialectTypes interface{} `json:"appliedDialectTypes"`
CreateTime interface{} `json:"createTime"`
Enabled interface{} `json:"enabled"`
ID interface{} `json:"id"`
Level int `json:"level"`
Metadata interface{} `json:"metadata"`
OrganizationID interface{} `json:"organizationId"`
Properties interface{} `json:"properties"`
RulesetID interface{} `json:"rulesetId"`
UpdateTime interface{} `json:"updateTime"`
Violation StreamExecuteViolation `json:"violation"`
}
StreamExecuteRule 违反的规则
type StreamExecuteSQLItem ¶
type StreamExecuteSQLItem struct {
SQLTuple StreamExecuteSQLTuple `json:"sqlTuple"`
ViolatedRules []StreamExecuteRule `json:"violatedRules"`
}
StreamExecuteSQLItem SQL 条目
type StreamExecuteSQLTuple ¶
type StreamExecuteSQLTuple struct {
ExecutedSQL string `json:"executedSql"`
Offset int `json:"offset"`
OriginalSQL string `json:"originalSql"`
SQLID string `json:"sqlId"`
}
StreamExecuteSQLTuple SQL 元组
type StreamExecuteViolation ¶
type StreamExecuteViolation struct {
Level int `json:"level"`
LocalizedMessage string `json:"localizedMessage"`
Offset int `json:"offset"`
Start int `json:"start"`
Stop int `json:"stop"`
Text string `json:"text"`
}
StreamExecuteViolation 违反详情
type TempDBAccount ¶
type TempDBAccount struct {
DBAccountUid string `json:"db_account_uid"`
AccountInfo AccountInfo `json:"account_info"`
Explanation string `json:"explanation"`
ExpiredTime string `json:"expired_time"`
DbService dmsV1.UidWithName `json:"db_service"`
}
TempDBAccount 临时数据库账号
func ListAuthDbAccount ¶
func ListAuthDbAccount(ctx context.Context, baseURL, projectUid, userId string) ([]*TempDBAccount, error)
Click to show internal directories.
Click to hide internal directories.