code: @GET
    @Produces(APPLICATION_JSON)
    @Timed
    @ExceptionMetered
    public List<String> list(@QueryParam("namePattern") final String namePattern,
                             @QueryParam("selector") final List<String> hostSelectors) {
  
      List<String> hosts = namePattern == null ? model.listHosts() : model.listHosts(namePattern);
  
      if (!hostSelectors.isEmpty()) {
        // check that all supplied selectors are parseable/valid
        final List<HostSelector> selectors = hostSelectors.stream()
            .map(selectorStr -> {
              final HostSelector parsed = HostSelector.parse(selectorStr);
              if (parsed == null) {
                throw new WebApplicationException(
                    Response.status(Response.Status.BAD_REQUEST)
                        .entity("Invalid host selector: " + selectorStr)
                        .build()
                );
              }
              return parsed;
            })
            .collect(Collectors.toList());
  
        final Map<String, Map<String, String>> hostsAndLabels = getLabels(hosts);
  
        final HostMatcher matcher = new HostMatcher(hostsAndLabels);
        hosts = matcher.getMatchingHosts(selectors);
      }
  
      return hosts;
    }
docs: Returns the list of hostnames of known hosts/agents.
  
  @return The list of hostnames.