mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): filter eips by associated (#21065)
This commit is contained in:
@@ -87,6 +87,9 @@ type ElasticipListInput struct {
|
||||
// example: elastic_ip
|
||||
Mode string `json:"mode"`
|
||||
|
||||
// 是否已关联资源
|
||||
IsAssociated *bool `json:"is_associated"`
|
||||
|
||||
// IP地址
|
||||
IpAddr []string `json:"ip_addr"`
|
||||
|
||||
|
||||
@@ -261,6 +261,14 @@ func (manager *SElasticipManager) ListItemFilter(
|
||||
q = q.Filter(sqlchemy.OR(sqlchemy.IsNull(q.Field("associate_id")), sqlchemy.IsEmpty(q.Field("associate_id"))))
|
||||
}
|
||||
|
||||
if query.IsAssociated != nil {
|
||||
if *query.IsAssociated {
|
||||
q = q.IsNotEmpty("associate_type")
|
||||
} else {
|
||||
q = q.IsNullOrEmpty("associate_type")
|
||||
}
|
||||
}
|
||||
|
||||
if len(query.Mode) > 0 {
|
||||
q = q.In("mode", query.Mode)
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ type ElasticipListOptions struct {
|
||||
AssociateId []string
|
||||
AssociateType []string
|
||||
AssociateName []string
|
||||
IsAssociated *bool
|
||||
|
||||
IpAddr []string
|
||||
options.BaseListOptions
|
||||
|
||||
Reference in New Issue
Block a user