Repository: cloudstack Updated Branches: refs/heads/4.4-forward 500c99eef -> cadefb1ae
CLOUDSTACK-6601: added "forDisplay" parameter to listLoadBalancerRules API Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cadefb1a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cadefb1a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cadefb1a Branch: refs/heads/4.4-forward Commit: cadefb1aeb2e1d973c9dcf38e7f793adc50599d6 Parents: 500c99e Author: Alena Prokharchyk <alena.prokharc...@citrix.com> Authored: Wed May 7 16:57:10 2014 -0700 Committer: Alena Prokharchyk <alena.prokharc...@citrix.com> Committed: Wed May 7 17:12:58 2014 -0700 ---------------------------------------------------------------------- .../user/loadbalancer/ListLoadBalancerRulesCmd.java | 15 +++++++++++++-- .../network/lb/LoadBalancingRulesManagerImpl.java | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cadefb1a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java index 013deb7..df6c989 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java @@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -32,6 +31,7 @@ import org.apache.cloudstack.api.response.LoadBalancerResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.network.rules.LoadBalancer; import com.cloud.utils.Pair; @@ -71,6 +71,9 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd { @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list by network id the rule belongs to") private Long networkId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -99,6 +102,14 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd { return networkId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cadefb1a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index b932e14..05fb325 100755 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -2250,6 +2250,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements Long instanceId = cmd.getVirtualMachineId(); Long networkId = cmd.getNetworkId(); Map<String, String> tags = cmd.getTags(); + Boolean forDisplay = cmd.getDisplay(); Account caller = CallContext.current().getCallingAccount(); List<Long> permittedDomains = new ArrayList<Long>(); @@ -2273,6 +2274,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements sb.and("sourceIpAddress", sb.entity().getSourceIpAddressId(), SearchCriteria.Op.EQ); sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ); sb.and("scheme", sb.entity().getScheme(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); if (instanceId != null) { SearchBuilder<LoadBalancerVMMapVO> lbVMSearch = _lb2VmMapDao.createSearchBuilder(); @@ -2342,6 +2344,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements } } + if (forDisplay != null) { + sc.setParameters("display", forDisplay); + } + //list only Public load balancers using this command sc.setParameters("scheme", Scheme.Public);