本文整理汇总了Java中org.dasein.cloud.compute.VMFilterOptions类的典型用法代码示例。如果您正苦于以下问题:Java VMFilterOptions类的具体用法?Java VMFilterOptions怎么用?Java VMFilterOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VMFilterOptions类属于org.dasein.cloud.compute包,在下文中一共展示了VMFilterOptions类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listVirtualMachines
import org.dasein.cloud.compute.VMFilterOptions; //导入依赖的package包/类
@Nonnull
@Override
public Iterable<VirtualMachine> listVirtualMachines(@Nullable VMFilterOptions options) throws InternalException, CloudException {
APITrace.begin(provider, LIST_VIRTUAL_MACHINES);
try {
try {
VirtustreamMethod method = new VirtustreamMethod(provider);
List<VirtualMachine> list = new ArrayList<VirtualMachine>();
String obj = method.getString("/VirtualMachine?$filter=IsTemplate eq false and IsRemoved eq false", LIST_VIRTUAL_MACHINES);
if (obj != null && obj.length() > 0) {
JSONArray json = new JSONArray(obj);
for (int i= 0; i<json.length(); i++) {
VirtualMachine vm = toVirtualMachine(json.getJSONObject(i));
if (vm != null && (options == null || options.matches(vm))) {
list.add(vm);
}
}
}
return list;
}
catch (JSONException e) {
logger.error(e);
throw new InternalException("Unable to parse JSONObject "+e.getMessage());
}
}
finally {
APITrace.end();
}
}
示例2: getVirtualMachine
import org.dasein.cloud.compute.VMFilterOptions; //导入依赖的package包/类
@Override
public VirtualMachine getVirtualMachine(@Nonnull String vmId) throws InternalException, CloudException {
//TODO: Ditch this - do readtopology call instead then toVM and throw away non matching device IDs.
VMFilterOptions options = VMFilterOptions.getInstance(vmId);
ArrayList<VirtualMachine> vms = (ArrayList<VirtualMachine>)listVirtualMachines(options);
for(VirtualMachine vm : vms){
if(vm.getProviderVirtualMachineId().equals(vmId)) return vm;
}
throw new InternalException("Could not find VM with ID: " + vmId);
}
示例3: listVirtualMachines
import org.dasein.cloud.compute.VMFilterOptions; //导入依赖的package包/类
@Override
public Iterable<VirtualMachine> listVirtualMachines() throws InternalException, CloudException {
VMFilterOptions options = VMFilterOptions.getInstance();
return listVirtualMachines(options);
}
示例4: listVirtualMachines
import org.dasein.cloud.compute.VMFilterOptions; //导入依赖的package包/类
@Override
@Nonnull
public Iterable<VirtualMachine> listVirtualMachines(@Nullable VMFilterOptions options) throws InternalException, CloudException {
return listVirtualMachines();
}