mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
cloudproxy: forwards: more list filter conditional keys
This commit is contained in:
@@ -51,7 +51,10 @@ type ForwardListInput struct {
|
||||
ProxyAgentId string
|
||||
ProxyEndpointId string
|
||||
|
||||
Type string
|
||||
Type string
|
||||
RemoteAddr string
|
||||
RemotePort *int
|
||||
BindPortReq *int
|
||||
|
||||
Opaque string
|
||||
}
|
||||
|
||||
@@ -358,6 +358,7 @@ func (man *SForwardManager) ListItemFilter(
|
||||
) (*sqlchemy.SQuery, error) {
|
||||
filters := [][2]string{
|
||||
[2]string{"type", input.Type},
|
||||
[2]string{"remote_addr", input.RemoteAddr},
|
||||
[2]string{"proxy_endpoint_id", input.ProxyEndpointId},
|
||||
[2]string{"proxy_agent_id", input.ProxyAgentId},
|
||||
[2]string{"opaque", input.Opaque},
|
||||
@@ -367,6 +368,18 @@ func (man *SForwardManager) ListItemFilter(
|
||||
q = q.Equals(filter[0], v)
|
||||
}
|
||||
}
|
||||
intFilters := []struct {
|
||||
name string
|
||||
val *int
|
||||
}{
|
||||
{"remote_port", input.RemotePort},
|
||||
{"bind_port_req", input.BindPortReq},
|
||||
}
|
||||
for _, filter := range intFilters {
|
||||
if v := filter.val; v != nil {
|
||||
q = q.Equals(filter.name, *v)
|
||||
}
|
||||
}
|
||||
return q, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user