private Version resolveVersionFlag(StringFlag flag, Node node, Allocation allocation) {
        String value = flag
                .with(Dimension.HOSTNAME, node.hostname())
                .with(Dimension.NODE_TYPE, node.type().name())
                .with(Dimension.TENANT_ID, allocation.owner().tenant().value())
                .with(Dimension.INSTANCE_ID, allocation.owner().serializedForm())
                .with(Dimension.CLUSTER_TYPE, allocation.membership().cluster().type().name())
                .with(Dimension.CLUSTER_ID, allocation.membership().cluster().id().value())
                .with(Dimension.VESPA_VERSION, allocation.membership().cluster().vespaVersion().toFullString())
                .value();

        return value.isEmpty() ?
               allocation.membership().cluster().vespaVersion() :
               value.indexOf('.') == -1 ?
               allocation.membership().cluster().vespaVersion().withQualifier(value) :
               new Version(value);
    }
Outputs the nodes in the given states to a node array
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodesResponse.java