fix(regoon): search rds by ip addr

This commit is contained in:
ioito
2022-05-09 22:16:19 +08:00
parent 029e27b826
commit 1a2f2deda4
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -217,6 +217,9 @@ type DBInstanceListInput struct {
EngineVersion string `json:"engine_version"`
InstanceType string `json:"instance_type"`
// 通过IP搜索RDS实例
IpAddr string `json:"ip_addr"`
}
type DBInstanceBackupListInput struct {
+5
View File
@@ -227,6 +227,11 @@ func (man *SDBInstanceManager) ListItemFilter(
q = q.Equals("instance_type", query.InstanceType)
}
if len(query.IpAddr) > 0 {
dn := DBInstanceNetworkManager.Query("dbinstance_id").Contains("ip_addr", query.IpAddr)
q = q.Filter(sqlchemy.In(q.Field("id"), dn.SubQuery()))
}
return q, nil
}
@@ -75,6 +75,7 @@ func (opts *DBInstanceCreateOptions) Params() (jsonutils.JSONObject, error) {
type DBInstanceListOptions struct {
options.BaseListOptions
BillingType string `help:"billing type" choices:"postpaid|prepaid"`
IpAddr string
}
func (opts *DBInstanceListOptions) Params() (jsonutils.JSONObject, error) {