mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-2628: added networkId parameter to the list of request parameters in listLoadBalancerRules API
This commit is contained in:
parent
f92db64c78
commit
7e6f3f94ba
@ -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///////////////////
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user