mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-420: listZones missing name parameter
When calling the listZones API command, you can now supply a name to pull a specific zone by name. Updated two classes to include name paramater and query data centers/zones by name if suppled: - server/src/com/cloud/api/query/QueryManagerImpl.java - api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
cc81413931
commit
53b6ba3798
@ -53,6 +53,9 @@ public class ListZonesByCmd extends BaseListCmd {
|
||||
description="the ID of the domain associated with the zone")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
|
||||
private Boolean showCapacities;
|
||||
|
||||
@ -72,6 +75,10 @@ public class ListZonesByCmd extends BaseListCmd {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
public Boolean getShowCapacities() {
|
||||
return showCapacities;
|
||||
}
|
||||
|
||||
@ -2190,12 +2190,15 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
Long domainId = cmd.getDomainId();
|
||||
Long id = cmd.getId();
|
||||
String keyword = cmd.getKeyword();
|
||||
String name = cmd.getName();
|
||||
|
||||
Filter searchFilter = new Filter(DataCenterJoinVO.class, null, false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchCriteria<DataCenterJoinVO> sc = _dcJoinDao.createSearchCriteria();
|
||||
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
} else if (name != null) {
|
||||
sc.addAnd("name", SearchCriteria.Op.EQ, name);
|
||||
} else {
|
||||
if (keyword != null) {
|
||||
SearchCriteria<DataCenterJoinVO> ssc = _dcJoinDao.createSearchCriteria();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user