Merge pull request #14225 from ioito/hotfix/qx-rds-ip-filter

fix(regoon): search rds by ip addr
This commit is contained in:
Zexi Li
2022-05-10 09:18:23 +08:00
committed by GitHub
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) {