mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 7162: added search by id to listZones command
status 7162: resolved fixed
This commit is contained in:
parent
1cd5526911
commit
a01aad84ed
@ -47,6 +47,8 @@ public class ListZonesByCmd extends BaseListCmd {
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the zone")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.AVAILABLE, type=CommandType.BOOLEAN, description="true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.")
|
||||
private Boolean available;
|
||||
@ -57,6 +59,10 @@ public class ListZonesByCmd extends BaseListCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Boolean isAvailable() {
|
||||
return available;
|
||||
}
|
||||
|
||||
@ -1328,6 +1328,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
Account account = UserContext.current().getAccount();
|
||||
List<DataCenterVO> dcs = null;
|
||||
Long domainId = cmd.getDomainId();
|
||||
Long id = cmd.getId();
|
||||
if(domainId != null){
|
||||
//for domainId != null
|
||||
//right now, we made the decision to only list zones associated with this domain
|
||||
@ -1405,6 +1406,16 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
}
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
for (DataCenterVO zone : dcs) {
|
||||
List<DataCenterVO> singleZone = new ArrayList<DataCenterVO>();
|
||||
if (zone.getId() == id) {
|
||||
singleZone.add(zone);
|
||||
}
|
||||
return singleZone;
|
||||
}
|
||||
}
|
||||
|
||||
return dcs;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user