Allow patching to unreserve
@@ -161,14 +161,11 @@ public class NodePatcher {
case "bandwidthGbps":
return node.with(node.flavor().with(node.flavor().resources().withBandwidthGbps(value.asDouble())));
case "modelName":
- if (value.type() == Type.NIX) {
- return node.withoutModelName();
- }
- return node.withModelName(asString(value));
+ return value.type() == Type.NIX ? node.withoutModelName() : node.withModelName(asString(value));
case "requiredDiskSpeed":
return patchRequiredDiskSpeed(asString(value));
case "reservedTo":
- return node.withReservedTo(TenantName.from(value.asString()));
+ return value.type() == Type.NIX ? node.withoutReservedTo() : node.withReservedTo(TenantName.from(value.asString()));
default :
throw new IllegalArgumentException("Could not apply field '" + name + "' on a node: No such modifiable field");
}
