> +
> + Console.Type type = (Console.Type) postParams.get("type");
> +
> + switch (type) {
> + case NOVNC:
> + case XVPVNC:
> + action = "os-getVNCConsole";
> + break;
> + case SPICE_HTML5:
> + action = "os-getSPICEConsole";
> + break;
> + case RDP_HTML5:
> + action = "os-getRDPConsole";
> + break;
> + default:
> + throw new IllegalArgumentException("Invalid type: " + type);
When calling getConsole() the user can supply a valid Console.Type object or
null. If null the binder will first process it (`fromValue()` is used later in
the response) and will throw an IAE. If not null, then it can only be a valid
Console.Type and thus `toString()` will serialize the enum. If all goes well
we'll get a response object which will be deserialized in a Console object
(containing a url, and a Console.Type). At this point is were fromValue() will
be used to deserialize the response type to a Console.Type enum. If at this
point the type returned from openstack is not valid, then maybe we should throw
some exception which could be IAE since from a little search I did, I haven't
found something more appropriate.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339/files#r13103055