cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [06/32] git commit: updated refs/heads/ui-vpc-redesign to f3cc57f
Date Fri, 24 May 2013 18:09:45 GMT
CLOUDSTACK-2628: added networkId parameter to the list of request parameters in listLoadBalancerRules
API


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7e6f3f94
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7e6f3f94
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7e6f3f94

Branch: refs/heads/ui-vpc-redesign
Commit: 7e6f3f94ba467f8f58ed6b130055bdd6df73815a
Parents: f92db64
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu May 23 10:24:44 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu May 23 16:06:57 2013 -0700

----------------------------------------------------------------------
 .../loadbalancer/ListLoadBalancerRulesCmd.java     |    9 +++++++
 .../api/response/LoadBalancerResponse.java         |   11 ++++++++-
 server/src/com/cloud/api/ApiResponseHelper.java    |   19 ++++++++------
 .../network/lb/LoadBalancingRulesManagerImpl.java  |    6 ++++
 4 files changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/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 e022cc7..21d5b2a 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
@@ -27,6 +27,7 @@ import org.apache.cloudstack.api.response.FirewallRuleResponse;
 import org.apache.cloudstack.api.response.IPAddressResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 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;
@@ -62,6 +63,10 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd
{
     @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
             description = "the availability zone ID")
     private Long zoneId;
+    
+    @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class,
+            description = "list by network id the rule belongs to")
+    private Long networkId;
 
     // ///////////////////////////////////////////////////
     // ///////////////// Accessors ///////////////////////
@@ -86,6 +91,10 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd
{
     public Long getZoneId() {
         return zoneId;
     }
+    
+    public Long getNetworkId() {
+        return networkId;
+    }
 
     // ///////////////////////////////////////////////////
     // ///////////// API Implementation///////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
index 79b01b1..0f18097 100644
--- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
@@ -57,10 +57,14 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
     @SerializedName(ApiConstants.ALGORITHM)
     @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)")
     private String algorithm;
+    
+    @SerializedName(ApiConstants.NETWORK_ID)
+    @Param(description = "the id of the guest network the lb rule belongs to")
+    private String networkId;
 
     @SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward
traffic from")
     private String cidrList;
-
+    
     @SerializedName(ApiConstants.ACCOUNT)
     @Param(description = "the account of the load balancer rule")
     private String accountName;
@@ -89,6 +93,7 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
 
     @SerializedName(ApiConstants.TAGS)  @Param(description="the list of resource tags associated
with load balancer", responseObject = ResourceTagResponse.class)
     private List<ResourceTagResponse> tags;
+    
 
     public void setId(String id) {
         this.id = id;
@@ -160,5 +165,9 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
     public void setTags(List<ResourceTagResponse> tags) {
         this.tags = tags;
     }
+    
+    public void setNetworkId(String networkId) {
+        this.networkId = networkId;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index fc1c6a0..540c8e9 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -34,12 +34,6 @@ import java.util.TimeZone;
 
 import javax.inject.Inject;
 
-import com.cloud.network.vpc.NetworkACL;
-import com.cloud.network.vpc.NetworkACLItem;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcOffering;
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.affinity.AffinityGroup;
@@ -49,8 +43,6 @@ import org.apache.cloudstack.api.ApiConstants.VMDetails;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.ResponseGenerator;
 import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
-import org.apache.cloudstack.region.PortableIp;
-import org.apache.cloudstack.region.PortableIpRange;
 import org.apache.cloudstack.api.response.AccountResponse;
 import org.apache.cloudstack.api.response.ApplicationLoadBalancerInstanceResponse;
 import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
@@ -146,6 +138,8 @@ import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
 import org.apache.cloudstack.region.Region;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.usage.Usage;
@@ -241,6 +235,12 @@ import com.cloud.network.security.SecurityGroup;
 import com.cloud.network.security.SecurityGroupVO;
 import com.cloud.network.security.SecurityRule;
 import com.cloud.network.security.SecurityRule.SecurityRuleType;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.PrivateGateway;
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcOffering;
 import com.cloud.offering.DiskOffering;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.offering.NetworkOffering.Detail;
@@ -776,6 +776,9 @@ public class ApiResponseHelper implements ResponseGenerator {
             tagResponses.add(tagResponse);
         }
         lbResponse.setTags(tagResponses);
+        
+        Network ntwk = ApiDBUtils.findNetworkById(loadBalancer.getNetworkId());
+        lbResponse.setNetworkId(ntwk.getUuid());
 
         lbResponse.setObjectName("loadbalancer");
         return lbResponse;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/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 520dd76..0118ca5 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -1902,6 +1902,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase
implements
         String name = cmd.getLoadBalancerRuleName();
         String keyword = cmd.getKeyword();
         Long instanceId = cmd.getVirtualMachineId();
+        Long networkId = cmd.getNetworkId();
         Map<String, String> tags = cmd.getTags();
 
         Account caller = UserContext.current().getCaller();
@@ -1922,6 +1923,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase
implements
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
         sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
         sb.and("sourceIpAddress", sb.entity().getSourceIpAddressId(), SearchCriteria.Op.EQ);
+        sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ);
 
         if (instanceId != null) {
             SearchBuilder<LoadBalancerVMMapVO> lbVMSearch = _lb2VmMapDao.createSearchBuilder();
@@ -1979,6 +1981,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase
implements
         if (zoneId != null) {
             sc.setJoinParameters("ipSearch", "zoneId", zoneId);
         }
+        
+        if (networkId != null) {
+            sc.setParameters("networkId", networkId);
+        }
 
         if (tags != null && !tags.isEmpty()) {
             int count = 0;


Mime
View raw message