Search in sources :

Example 1 with HostDetails

use of org.apache.cloudstack.api.ApiConstants.HostDetails in project cloudstack by apache.

the class ListHostsCmd method getDetails.

public EnumSet<HostDetails> getDetails() throws InvalidParameterValueException {
    EnumSet<HostDetails> dv;
    if (viewDetails == null || viewDetails.size() <= 0) {
        dv = EnumSet.of(HostDetails.all);
    } else {
        try {
            ArrayList<HostDetails> dc = new ArrayList<HostDetails>();
            for (String detail : viewDetails) {
                dc.add(HostDetails.valueOf(detail));
            }
            dv = EnumSet.copyOf(dc);
        } catch (IllegalArgumentException e) {
            throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(HostDetails.class));
        }
    }
    return dv;
}
Also used : InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) HostDetails(org.apache.cloudstack.api.ApiConstants.HostDetails) ArrayList(java.util.ArrayList)

Aggregations

InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 ArrayList (java.util.ArrayList)1 HostDetails (org.apache.cloudstack.api.ApiConstants.HostDetails)1