mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +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 ///////////////////// |     //////////////// 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.") |     @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; |     private Boolean available; | ||||||
| @ -56,6 +58,10 @@ public class ListZonesByCmd extends BaseListCmd { | |||||||
|     ///////////////////////////////////////////////////// |     ///////////////////////////////////////////////////// | ||||||
|     /////////////////// Accessors /////////////////////// |     /////////////////// Accessors /////////////////////// | ||||||
|     ///////////////////////////////////////////////////// |     ///////////////////////////////////////////////////// | ||||||
|  |      | ||||||
|  |     public Long getId() { | ||||||
|  |         return id; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     public Boolean isAvailable() { |     public Boolean isAvailable() { | ||||||
|         return available; |         return available; | ||||||
|  | |||||||
| @ -1328,6 +1328,7 @@ public class ManagementServerImpl implements ManagementServer { | |||||||
|         Account account = UserContext.current().getAccount();    	 |         Account account = UserContext.current().getAccount();    	 | ||||||
|         List<DataCenterVO> dcs = null; |         List<DataCenterVO> dcs = null; | ||||||
|     	Long domainId = cmd.getDomainId(); |     	Long domainId = cmd.getDomainId(); | ||||||
|  |     	Long id = cmd.getId(); | ||||||
|     	if(domainId != null){ |     	if(domainId != null){ | ||||||
|     		//for domainId != null |     		//for domainId != null | ||||||
|     		//right now, we made the decision to only list zones associated with this domain |     		//right now, we made the decision to only list zones associated with this domain | ||||||
| @ -1404,7 +1405,17 @@ 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; |         return dcs; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user