mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix(region): add filter for eip
This commit is contained in:
@@ -222,6 +222,17 @@ func (manager *SElasticipManager) ListItemFilter(
|
||||
sqlchemy.IsNullOrEmpty(q.Field("associate_id")),
|
||||
),
|
||||
)
|
||||
case api.EIP_ASSOCIATE_TYPE_LOADBALANCER:
|
||||
_lb, err := validators.ValidateModel(userCred, LoadbalancerManager, &query.UsableEipForAssociateId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lb := _lb.(*SLoadbalancer)
|
||||
q = q.Equals("cloudregion_id", lb.CloudregionId)
|
||||
if len(lb.ManagerId) > 0 {
|
||||
q = q.Equals("manager_id", lb.ManagerId)
|
||||
}
|
||||
q = q.IsNullOrEmpty("associate_type")
|
||||
default:
|
||||
return nil, httperrors.NewInputParameterError("Not support associate type %s, only support %s", associateType, api.EIP_ASSOCIATE_VALID_TYPES)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type ElasticipListOptions struct {
|
||||
Region string `help:"List eips in cloudregion"`
|
||||
|
||||
Usable *bool `help:"List all zones that is usable"`
|
||||
UsableEipForAssociateType string `help:"With associate id filter which eip can associate" choices:"server|natgateway"`
|
||||
UsableEipForAssociateType string `help:"With associate id filter which eip can associate" choices:"server|natgateway|loadbalancer"`
|
||||
UsableEipForAssociateId string `help:"With associate type filter which eip can associate"`
|
||||
|
||||
options.BaseListOptions
|
||||
|
||||
Reference in New Issue
Block a user