use of com.google.api.services.compute.model.MachineTypeList in project platformlayer by platformlayer.
the class GoogleComputeClient method listMachineTypes.
private Iterable<MachineType> listMachineTypes(String projectId) throws OpsException {
List<MachineType> ret = Lists.newArrayList();
MachineTypeList machineTypeList;
try {
log.debug("Listing machine types in project " + projectId);
machineTypeList = compute.machineTypes().list(projectId).execute();
} catch (IOException e) {
throw new OpsException("Error listing machine types", e);
}
if (machineTypeList.getItems() != null) {
ret.addAll(machineTypeList.getItems());
}
return ret;
}
use of com.google.api.services.compute.model.MachineTypeList in project google-cloud-java by GoogleCloudPlatform.
the class HttpComputeRpc method listMachineTypes.
@Override
public Tuple<String, Iterable<MachineType>> listMachineTypes(String zone, Map<Option, ?> options) {
try {
MachineTypeList machineTypesList = compute.machineTypes().list(this.options.getProjectId(), zone).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).setFields(Option.FIELDS.getString(options)).execute();
Iterable<MachineType> machineTypes = machineTypesList.getItems();
return Tuple.of(machineTypesList.getNextPageToken(), machineTypes);
} catch (IOException ex) {
throw translate(ex);
}
}
Aggregations