feat(xinfra): include cluster and mysql version in register payload
This commit is contained in:
@@ -2385,18 +2385,20 @@ type cloudDMRegisterRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type cloudDMDataSource struct {
|
type cloudDMDataSource struct {
|
||||||
InstanceName string `json:"instanceName"`
|
InstanceName string `json:"instanceName"`
|
||||||
InstanceDesc string `json:"instanceDesc"`
|
InstanceDesc string `json:"instanceDesc"`
|
||||||
DSType string `json:"dsType"`
|
DSType string `json:"dsType"`
|
||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
SecurityType string `json:"securityType"`
|
ClusterID *uint64 `json:"cluster_id"`
|
||||||
UserName string `json:"userName"`
|
MySQLVersion string `json:"mysql_version"`
|
||||||
Password string `json:"password"`
|
SecurityType string `json:"securityType"`
|
||||||
DefaultSchema any `json:"defaultSchema"`
|
UserName string `json:"userName"`
|
||||||
ClientTimeZone string `json:"clientTimeZone"`
|
Password string `json:"password"`
|
||||||
ConnectTimeoutMs int `json:"connectTimeoutMs"`
|
DefaultSchema any `json:"defaultSchema"`
|
||||||
SocketTimeoutSecs int `json:"socketTimeoutSeconds"`
|
ClientTimeZone string `json:"clientTimeZone"`
|
||||||
ConnectionCharset string `json:"connectionCharset"`
|
ConnectTimeoutMs int `json:"connectTimeoutMs"`
|
||||||
|
SocketTimeoutSecs int `json:"socketTimeoutSeconds"`
|
||||||
|
ConnectionCharset string `json:"connectionCharset"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func cloudDMExternalResourceID(instanceID uint64) string {
|
func cloudDMExternalResourceID(instanceID uint64) string {
|
||||||
@@ -2466,6 +2468,13 @@ func buildCloudDMRegisterRequest(instance model.DeploymentResult, payload delive
|
|||||||
if description == "" {
|
if description == "" {
|
||||||
description = instance.InstanceName
|
description = instance.InstanceName
|
||||||
}
|
}
|
||||||
|
mysqlVersion := strings.TrimSpace(instance.Version)
|
||||||
|
if mysqlVersion == "" {
|
||||||
|
mysqlVersion = strings.TrimSpace(payload.MySQLVersion)
|
||||||
|
}
|
||||||
|
if mysqlVersion == "" {
|
||||||
|
mysqlVersion = "8.0"
|
||||||
|
}
|
||||||
return cloudDMRegisterRequest{
|
return cloudDMRegisterRequest{
|
||||||
SourceSystem: "xinfra",
|
SourceSystem: "xinfra",
|
||||||
ResourceType: "MYSQL_INSTANCE",
|
ResourceType: "MYSQL_INSTANCE",
|
||||||
@@ -2475,6 +2484,8 @@ func buildCloudDMRegisterRequest(instance model.DeploymentResult, payload delive
|
|||||||
InstanceDesc: description,
|
InstanceDesc: description,
|
||||||
DSType: "MySQL",
|
DSType: "MySQL",
|
||||||
Host: net.JoinHostPort(instance.Host, strconv.Itoa(instance.Port)),
|
Host: net.JoinHostPort(instance.Host, strconv.Itoa(instance.Port)),
|
||||||
|
ClusterID: nil,
|
||||||
|
MySQLVersion: mysqlVersion,
|
||||||
SecurityType: "USER_PASSWD",
|
SecurityType: "USER_PASSWD",
|
||||||
UserName: "root",
|
UserName: "root",
|
||||||
Password: password,
|
Password: password,
|
||||||
|
|||||||
Reference in New Issue
Block a user