list* APIs - added parameter helping to filter by "display" flag (available to ROOT admin only)

This commit is contained in:
Alena Prokharchyk 2014-03-03 14:37:46 -08:00
parent fd43cf1516
commit bbf5a912c6
32 changed files with 314 additions and 38 deletions

View File

@ -93,12 +93,13 @@ public interface VpcService {
* @param restartRequired TODO
* @param tags TODO
* @param projectId TODO
* @param display TODO
* @param vpc
* @return
*/
public List<? extends Vpc> listVpcs(Long id, String vpcName, String displayText, List<String> supportedServicesStr, String cidr, Long vpcOffId, String state,
String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired,
Map<String, String> tags, Long projectId);
Map<String, String> tags, Long projectId, Boolean display);
/**
* Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend

View File

@ -16,6 +16,10 @@
// under the License.
package org.apache.cloudstack.api;
import org.apache.cloudstack.context.CallContext;
import com.cloud.user.Account;
public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd {
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.")
@ -24,4 +28,12 @@ public abstract class BaseListAccountResourcesCmd extends BaseListDomainResource
public String getAccountName() {
return accountName;
}
public Boolean getDisplay() {
Account caller = CallContext.current().getCallingAccount();
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
return true;
}
return null;
}
}

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.address;
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.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -33,6 +32,7 @@ import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.network.IpAddress;
import com.cloud.utils.Pair;
@ -90,6 +90,9 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List ips belonging to the VPC")
private Long vpcId;
@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 ///////////////////////
/////////////////////////////////////////////////////
@ -137,6 +140,14 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd {
return vpcId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.autoscale;
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.BaseListProjectAndAccountResourcesCmd;
@ -31,6 +30,7 @@ import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.as.AutoScaleVmGroup;
@ -61,6 +61,9 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID")
private Long zoneId;
@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 ///////////////////////
// ///////////////////////////////////////////////////
@ -85,6 +88,14 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources
return zoneId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
@ -58,6 +59,9 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, since = "4.4", description = "availability zone for the auto deployed virtual machine")
private Long zoneId;
@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 ///////////////////////
// ///////////////////////////////////////////////////
@ -81,6 +85,15 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
public Long getZoneId() {
return zoneId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////

View File

@ -20,8 +20,6 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.Parameter;
@ -29,6 +27,7 @@ import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.log4j.Logger;
import com.cloud.network.rules.FirewallRule;
import com.cloud.utils.Pair;

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.firewall;
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;
@ -30,6 +29,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.NetworkResponse;
import org.apache.log4j.Logger;
import com.cloud.network.rules.FirewallRule;
import com.cloud.utils.Pair;
@ -59,6 +59,9 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
since = "4.3")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -79,6 +82,14 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
return networkId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.firewall;
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;
@ -29,6 +28,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.NetworkResponse;
import org.apache.log4j.Logger;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.utils.Pair;
@ -60,6 +60,9 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
since = "4.3")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -76,6 +79,14 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
return networkId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -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;
@ -30,6 +29,7 @@ import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
@ -67,6 +67,9 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd
@Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "the network id of the Load Balancer")
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 ///////////////////////
// ///////////////////////////////////////////////////
@ -91,6 +94,14 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd
return sourceIpNetworkId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
@Override
public String getCommandName() {
return s_name;

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
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.BaseListProjectAndAccountResourcesCmd;
@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
import com.cloud.network.vpc.NetworkACL;
import com.cloud.utils.Pair;
@ -55,6 +55,9 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list network ACLs by specified name")
private String name;
@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 ///////////////////////
/////////////////////////////////////////////////////
@ -75,6 +78,13 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm
return name;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
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;
@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.log4j.Logger;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.utils.Pair;
@ -62,6 +62,9 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "list network ACL Items by Action")
private String action;
@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 ///////////////////////
/////////////////////////////////////////////////////
@ -90,6 +93,14 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
return action;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
@ -81,6 +82,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network belongs to vpc")
private Boolean forVpc;
@Parameter(name = ApiConstants.DISPLAY_NETWORK, 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 ///////////////////////
/////////////////////////////////////////////////////
@ -137,6 +141,13 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
return forVpc;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm;
import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -59,6 +60,9 @@ public class ListNicsCmd extends BaseListCmd {
@Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list nic of the specific vm's network")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -93,6 +97,15 @@ public class ListNicsCmd extends BaseListCmd {
return caller.getAccountId();
}
public Boolean getDisplay() {
Account caller = CallContext.current().getCallingAccount();
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
return true;
}
return display;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
@ -115,6 +116,9 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "list by the service offering", since = "4.4")
private Long serviceOffId;
@Parameter(name = ApiConstants.DISPLAY_VM, 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 ///////////////////////
/////////////////////////////////////////////////////
@ -205,6 +209,13 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
return dv;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -75,6 +75,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "list volumes by disk offering")
private Long diskOfferingId;
@Parameter(name = ApiConstants.DISPLAY_VOLUME, 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 ///////////////////////
/////////////////////////////////////////////////////
@ -115,6 +118,13 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
return storageId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.vpc;
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;
@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.network.vpc.Vpc;
@ -69,6 +69,9 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "list VPCs by restartRequired option")
private Boolean restartRequired;
@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 ///////////////////////
/////////////////////////////////////////////////////
@ -109,6 +112,14 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd {
return restartRequired;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -118,7 +129,7 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd {
List<? extends Vpc> vpcs =
_vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(),
this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getZoneId(), this.isRecursive(), this.listAll(), getRestartRequired(), getTags(),
getProjectId());
getProjectId(), getDisplay());
ListResponse<VpcResponse> response = new ListResponse<VpcResponse>();
List<VpcResponse> offeringResponses = new ArrayList<VpcResponse>();
for (Vpc vpc : vpcs) {

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn;
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.BaseListProjectAndAccountResourcesCmd;
@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
import org.apache.log4j.Logger;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.utils.Pair;
@ -60,6 +60,9 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC
since = "4.3")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -76,6 +79,14 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC
return networkId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn;
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.BaseListProjectAndAccountResourcesCmd;
@ -28,6 +27,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.utils.Pair;
@ -48,6 +48,9 @@ public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd
@Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "id of vpc")
private Long vpcId;
@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 ///////////////////////
/////////////////////////////////////////////////////
@ -60,6 +63,14 @@ public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd
return vpcId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn;
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.BaseListProjectAndAccountResourcesCmd;
@ -28,6 +27,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.utils.Pair;
@ -49,6 +49,9 @@ public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd {
@Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "id of vpc")
private Long vpcId;
@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 ///////////////////////
/////////////////////////////////////////////////////
@ -61,6 +64,14 @@ public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd {
return vpcId;
}
@Override
public Boolean getDisplay() {
if (display != null) {
return display;
}
return super.getDisplay();
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -291,5 +291,4 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
List<Integer> results = customSearch(sc, null);
return results.get(0);
}
}

View File

@ -712,6 +712,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
boolean listAll = cmd.listAll();
Long id = cmd.getId();
Map<String, String> tags = cmd.getTags();
Boolean display = cmd.getDisplay();
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject =
new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
@ -736,6 +737,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
c.addCriteria(Criteria.VPC_ID, cmd.getVpcId());
c.addCriteria(Criteria.AFFINITY_GROUP_ID, cmd.getAffinityGroupId());
c.addCriteria(Criteria.SERVICE_OFFERING_ID, cmd.getServiceOfferingId());
c.addCriteria(Criteria.DISPLAY, cmd.getDisplay());
if (domainId != null) {
c.addCriteria(Criteria.DOMAINID, domainId);
@ -793,6 +795,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Object vpcId = c.getCriteria(Criteria.VPC_ID);
Object affinityGroupId = c.getCriteria(Criteria.AFFINITY_GROUP_ID);
Object serviceOffId = c.getCriteria(Criteria.SERVICE_OFFERING_ID);
Object display = c.getCriteria(Criteria.DISPLAY);
sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
@ -812,7 +815,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
if (serviceOffId != null) {
sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ);
}
if (display != null) {
sb.and("display", sb.entity().isDisplayVm(), SearchCriteria.Op.EQ);
}
if (groupId != null && (Long)groupId != -1) {
sb.and("instanceGroupId", sb.entity().getInstanceGroupId(), SearchCriteria.Op.EQ);
}
@ -872,6 +877,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sc.setParameters("serviceOfferingId", serviceOffId);
}
if (display != null) {
sc.setParameters("display", display);
}
if (id != null) {
sc.setParameters("id", id);
}
@ -1623,6 +1632,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
boolean isRootAdmin = _accountMgr.isRootAdmin(caller.getType());
Long storageId = cmd.getStorageId();
Long diskOffId = cmd.getDiskOfferingId();
Boolean display = cmd.getDisplay();
Long zoneId = cmd.getZoneId();
Long podId = null;
@ -1657,6 +1667,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
sb.and("storageId", sb.entity().getPoolId(), SearchCriteria.Op.EQ);
sb.and("diskOfferingId", sb.entity().getDiskOfferingId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplayVolume(), SearchCriteria.Op.EQ);
// Only return volumes that are not destroyed
sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
sb.and("systemUse", sb.entity().isSystemUse(), SearchCriteria.Op.NEQ);
@ -1684,6 +1695,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sc.setParameters("name", name);
}
if (display != null) {
sc.setParameters("display", display);
}
sc.setParameters("systemUse", 1);
if (tags != null && !tags.isEmpty()) {

View File

@ -1383,6 +1383,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
Boolean canUseForDeploy = cmd.canUseForDeploy();
Map<String, String> tags = cmd.getTags();
Boolean forVpc = cmd.getForVpc();
Boolean display = cmd.getDisplay();
// 1) default is system to false if not specified
// 2) reset parameter to false if it's specified by the regular user
@ -1515,33 +1516,33 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
//get account level networks
networksToReturn.addAll(listAccountSpecificNetworks(
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired,
specifyIpRanges, vpcId, tags), searchFilter, permittedAccounts));
specifyIpRanges, vpcId, tags, display), searchFilter, permittedAccounts));
//get domain level networks
if (domainId != null) {
networksToReturn.addAll(listDomainLevelNetworks(
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, true, restartRequired,
specifyIpRanges, vpcId, tags), searchFilter, domainId, false));
specifyIpRanges, vpcId, tags, display), searchFilter, domainId, false));
}
} else {
//add account specific networks
networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired,
specifyIpRanges, vpcId, tags), searchFilter, path, isRecursive));
specifyIpRanges, vpcId, tags, display), searchFilter, path, isRecursive));
//add domain specific networks of domain + parent domains
networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired,
specifyIpRanges, vpcId, tags), searchFilter, path, isRecursive));
specifyIpRanges, vpcId, tags, display), searchFilter, path, isRecursive));
//add networks of subdomains
if (domainId == null) {
networksToReturn.addAll(listDomainLevelNetworks(
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, true, restartRequired,
specifyIpRanges, vpcId, tags), searchFilter, caller.getDomainId(), true));
specifyIpRanges, vpcId, tags, display), searchFilter, caller.getDomainId(), true));
}
}
} else {
networksToReturn = _networksDao.search(
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired,
specifyIpRanges, vpcId, tags), searchFilter);
specifyIpRanges, vpcId, tags, display), searchFilter);
}
if (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !networksToReturn.isEmpty()) {
@ -1608,7 +1609,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, Boolean isSystem, Long zoneId, String guestIpType,
String trafficType, Long physicalNetworkId, String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId,
Map<String, String> tags) {
Map<String, String> tags, Boolean display) {
SearchCriteria<NetworkVO> sc = sb.create();
@ -1622,6 +1623,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
}
if (display != null) {
sc.addAnd("displayNetwork", SearchCriteria.Op.EQ, display);
}
if (id != null) {
sc.addAnd("id", SearchCriteria.Op.EQ, id);
}
@ -4007,14 +4012,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
Long nicId = cmd.getNicId();
long vmId = cmd.getVmId();
Long networkId = cmd.getNetworkId();
UserVmVO userVm = _userVmDao.findById(vmId);
if (userVm == null) {
if (userVm == null || (!userVm.isDisplayVm() && caller.getType() == Account.ACCOUNT_TYPE_NORMAL)) {
InvalidParameterValueException ex = new InvalidParameterValueException("Virtual mahine id does not exist");
ex.addProxyObject(Long.valueOf(vmId).toString(), "vmId");
throw ex;
}
_accountMgr.checkAccess(caller, null, true, userVm);
return _networkMgr.listVmNics(vmId, nicId, networkId);
}

View File

@ -454,6 +454,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
String otherDeployParams = cmd.getOtherDeployParams();
Long serviceOffId = cmd.getServiceOfferingId();
Long zoneId = cmd.getZoneId();
Boolean display = cmd.getDisplay();
SearchWrapper<AutoScaleVmProfileVO> searchWrapper = new SearchWrapper<AutoScaleVmProfileVO>(_autoScaleVmProfileDao, AutoScaleVmProfileVO.class, cmd, cmd.getId());
SearchBuilder<AutoScaleVmProfileVO> sb = searchWrapper.getSearchBuilder();
@ -463,6 +464,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ);
sb.and("otherDeployParams", sb.entity().getOtherDeployParams(), SearchCriteria.Op.LIKE);
sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
SearchCriteria<AutoScaleVmProfileVO> sc = searchWrapper.buildSearchCriteria();
if (id != null) {
@ -483,6 +485,10 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
sc.setParameters("zoneId", zoneId);
}
if (display != null) {
sc.setParameters("display", display);
}
return searchWrapper.search();
}
@ -864,6 +870,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
Long loadBalancerId = cmd.getLoadBalancerId();
Long profileId = cmd.getProfileId();
Long zoneId = cmd.getZoneId();
Boolean forDisplay = cmd.getDisplay();
SearchWrapper<AutoScaleVmGroupVO> searchWrapper = new SearchWrapper<AutoScaleVmGroupVO>(_autoScaleVmGroupDao, AutoScaleVmGroupVO.class, cmd, cmd.getId());
SearchBuilder<AutoScaleVmGroupVO> sb = searchWrapper.getSearchBuilder();
@ -872,6 +879,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
sb.and("loadBalancerId", sb.entity().getLoadBalancerId(), SearchCriteria.Op.EQ);
sb.and("profileId", sb.entity().getProfileId(), SearchCriteria.Op.EQ);
sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
if (policyId != null) {
SearchBuilder<AutoScaleVmGroupPolicyMapVO> asVmGroupPolicySearch = _autoScaleVmGroupPolicyMapDao.createSearchBuilder();
@ -895,6 +903,9 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
if (policyId != null) {
sc.setJoinParameters("asVmGroupPolicySearch", "policyId", policyId);
}
if (forDisplay != null) {
sc.setParameters("display", forDisplay);
}
return searchWrapper.search();
}

View File

@ -259,6 +259,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
Long networkId = cmd.getNetworkId();
Map<String, String> tags = cmd.getTags();
FirewallRule.TrafficType trafficType = cmd.getTrafficType();
Boolean display = cmd.getDisplay();
Account caller = CallContext.current().getCallingAccount();
List<Long> permittedAccounts = new ArrayList<Long>();
@ -287,6 +288,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
sb.and("networkId", sb.entity().getNetworkId(), Op.EQ);
sb.and("ip", sb.entity().getSourceIpAddressId(), Op.EQ);
sb.and("purpose", sb.entity().getPurpose(), Op.EQ);
sb.and("display", sb.entity().isDisplay(), Op.EQ);
if (tags != null && !tags.isEmpty()) {
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
@ -317,6 +319,10 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
}
}
if (display != null) {
sc.setParameters("display", display);
}
if (ipId != null) {
sc.setParameters("ip", ipId);
}

View File

@ -779,6 +779,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
Long id = cmd.getId();
Map<String, String> tags = cmd.getTags();
Long networkId = cmd.getNetworkId();
Boolean display = cmd.getDisplay();
Account caller = CallContext.current().getCallingAccount();
List<Long> permittedAccounts = new ArrayList<Long>();
@ -806,6 +807,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
sb.and("ip", sb.entity().getSourceIpAddressId(), Op.EQ);
sb.and("purpose", sb.entity().getPurpose(), Op.EQ);
sb.and("networkId", sb.entity().getNetworkId(), Op.EQ);
sb.and("display", sb.entity().isDisplay(), Op.EQ);
if (tags != null && !tags.isEmpty()) {
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
@ -826,6 +828,10 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
sc.setParameters("id", id);
}
if (display != null) {
sc.setParameters("display", display);
}
if (tags != null && !tags.isEmpty()) {
int count = 0;
sc.setJoinParameters("tagSearch", "resourceType", ResourceObjectType.PortForwardingRule.toString());

View File

@ -118,10 +118,13 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
Long networkId = cmd.getNetworkId();
Long vpcId = cmd.getVpcId();
String keyword = cmd.getKeyword();
Boolean display = cmd.getDisplay();
SearchBuilder<NetworkACLVO> sb = _networkACLDao.createSearchBuilder();
sb.and("id", sb.entity().getId(), Op.EQ);
sb.and("name", sb.entity().getName(), Op.EQ);
sb.and("vpcId", sb.entity().getVpcId(), Op.IN);
sb.and("display", sb.entity().isDisplay(), Op.EQ);
Account caller = CallContext.current().getCallingAccount();
@ -140,6 +143,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
}
if (display != null) {
sc.setParameters("display", display);
}
if(id != null){
sc.setParameters("id", id);
}
@ -477,6 +484,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
String action = cmd.getAction();
Map<String, String> tags = cmd.getTags();
Account caller = CallContext.current().getCallingAccount();
Boolean display = cmd.getDisplay();
Filter filter = new Filter(NetworkACLItemVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<NetworkACLItemVO> sb = _networkACLItemDao.createSearchBuilder();
@ -486,6 +494,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
sb.and("trafficType", sb.entity().getTrafficType(), Op.EQ);
sb.and("protocol", sb.entity().getProtocol(), Op.EQ);
sb.and("action", sb.entity().getAction(), Op.EQ);
sb.and("display", sb.entity().isDisplay(), Op.EQ);
if (tags != null && !tags.isEmpty()) {
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
@ -508,6 +517,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
SearchCriteria<NetworkACLItemVO> sc = sb.create();
if (display != null) {
sc.setParameters("display", display);
}
if (id != null) {
sc.setParameters("id", id);
}

View File

@ -813,7 +813,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
@Override
public List<? extends Vpc> listVpcs(Long id, String vpcName, String displayText, List<String> supportedServicesStr, String cidr, Long vpcOffId, String state,
String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired,
Map<String, String> tags, Long projectId) {
Map<String, String> tags, Long projectId, Boolean display) {
Account caller = CallContext.current().getCallingAccount();
List<Long> permittedAccounts = new ArrayList<Long>();
@ -836,6 +836,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
sb.and("restartRequired", sb.entity().isRestartRequired(), SearchCriteria.Op.EQ);
sb.and("cidr", sb.entity().getCidr(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
if (tags != null && !tags.isEmpty()) {
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
@ -878,6 +879,10 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
}
}
if (display != null) {
sc.setParameters("display", display);
}
if (id != null) {
sc.addAnd("id", SearchCriteria.Op.EQ, id);
}

View File

@ -618,6 +618,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
Long vpnId = cmd.getId();
Long networkId = cmd.getNetworkId();
List<Long> permittedAccounts = new ArrayList<Long>();
Boolean display = cmd.getDisplay();
if (ipAddressId != null) {
PublicIpAddress publicIp = _networkMgr.getPublicIpAddress(ipAddressId);
@ -648,6 +649,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
sb.and("id", sb.entity().getId(), Op.EQ);
sb.and("networkId", sb.entity().getNetworkId(), Op.EQ);
sb.and("state", sb.entity().getState(), Op.EQ);
sb.and("display", sb.entity().isDisplay(), Op.EQ);
SearchCriteria<RemoteAccessVpnVO> sc = sb.create();
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);

View File

@ -611,6 +611,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
public Pair<List<? extends Site2SiteVpnGateway>, Integer> searchForVpnGateways(ListVpnGatewaysCmd cmd) {
Long id = cmd.getId();
Long vpcId = cmd.getVpcId();
Boolean display = cmd.getDisplay();
Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
@ -635,6 +636,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
SearchCriteria<Site2SiteVpnGatewayVO> sc = sb.create();
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
@ -643,6 +645,10 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
sc.addAnd("id", SearchCriteria.Op.EQ, id);
}
if (display != null) {
sc.setParameters("display", display);
}
if (vpcId != null) {
sc.addAnd("vpcId", SearchCriteria.Op.EQ, vpcId);
}
@ -655,6 +661,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
public Pair<List<? extends Site2SiteVpnConnection>, Integer> searchForVpnConnections(ListVpnConnectionsCmd cmd) {
Long id = cmd.getId();
Long vpcId = cmd.getVpcId();
Boolean display = cmd.getDisplay();
Long domainId = cmd.getDomainId();
boolean isRecursive = cmd.isRecursive();
@ -678,6 +685,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
if (vpcId != null) {
SearchBuilder<Site2SiteVpnGatewayVO> gwSearch = _vpnGatewayDao.createSearchBuilder();
@ -688,6 +696,9 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
SearchCriteria<Site2SiteVpnConnectionVO> sc = sb.create();
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
if (display != null) {
sc.setParameters("display", display);
}
if (id != null) {
sc.addAnd("id", SearchCriteria.Op.EQ, id);
}

View File

@ -85,6 +85,7 @@ public class Criteria {
public static final String VPC_ID = "vpcId";
public static final String AFFINITY_GROUP_ID = "affinitygroupid";
public static final String SERVICE_OFFERING_ID = "serviceofferingid";
public static final String DISPLAY = "display";
public Criteria(String orderBy, Boolean ascending, Long offset, Long limit) {
this.offset = offset;

View File

@ -1900,6 +1900,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
Boolean sourceNat = cmd.getIsSourceNat();
Boolean staticNat = cmd.getIsStaticNat();
Long vpcId = cmd.getVpcId();
Boolean forDisplay = cmd.getDisplay();
Map<String, String> tags = cmd.getTags();
Boolean isAllocated = cmd.isAllocatedOnly();
@ -1935,6 +1936,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
sb.and("isSourceNat", sb.entity().isSourceNat(), SearchCriteria.Op.EQ);
sb.and("isStaticNat", sb.entity().isOneToOneNat(), SearchCriteria.Op.EQ);
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
if (forLoadBalancing != null && forLoadBalancing) {
SearchBuilder<LoadBalancerVO> lbSearch = _loadbalancerDao.createSearchBuilder();
@ -2032,6 +2034,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
sc.setParameters("associatedNetworkIdEq", associatedNetworkId);
}
if (forDisplay != null) {
sc.setParameters("display", forDisplay);
}
Pair<List<IPAddressVO>, Integer> result = _publicIpAddressDao.searchAndCount(sc, searchFilter);
return new Pair<List<? extends IpAddress>, Integer>(result.first(), result.second());
}

View File

@ -383,6 +383,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
String keyword = cmd.getKeyword();
Scheme scheme = cmd.getScheme();
Long networkId = cmd.getNetworkId();
Boolean display = cmd.getDisplay();
Map<String, String> tags = cmd.getTags();
@ -406,6 +407,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
sb.and("sourceIpAddressNetworkId", sb.entity().getSourceIpNetworkId(), SearchCriteria.Op.EQ);
sb.and("scheme", sb.entity().getScheme(), SearchCriteria.Op.EQ);
sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
//list only load balancers having not null sourceIp/sourceIpNtwkId
sb.and("sourceIpAddress", sb.entity().getSourceIp(), SearchCriteria.Op.NNULL);
@ -467,6 +469,10 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
}
}
if (display != null) {
sc.setParameters("display", display);
}
Pair<List<ApplicationLoadBalancerRuleVO>, Integer> result = _lbDao.searchAndCount(sc, searchFilter);
return new Pair<List<? extends ApplicationLoadBalancerRule>, Integer>(result.first(), result.second());
}