String name = checkNotNull(postParams.remove("name"), "name").toString();
String template = checkNotNull(postParams.remove("template"), "template").toString();
SortedMap<ResourceType, String> virtualHardwareQuantity = Maps.newTreeMap();
InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
String network = (defaultNetwork != null) ? defaultNetwork.get().getHref().toASCIIString() : null;
String fenceMode = defaultFenceMode;
String networkName = name;
if (options != null) {
if (options.getNetworkConfig().size() > 0) {
NetworkConfig config = Iterables.get(options.getNetworkConfig(), 0);
network = ifNullDefaultTo(config.getParentNetwork(), network);
fenceMode = ifNullDefaultTo(config.getFenceMode(), defaultFenceMode);
networkName = ifNullDefaultTo(config.getNetworkName(), networkName);
}
addQuantity(options, virtualHardwareQuantity);