class ClusterResource {

  @GET
  @Path("/{cluster_name}")
  public Response getCluster(
      @PathParam("cluster_name") String clusterName,
      @QueryParam("limit") Optional<Integer> limit) {

    LOG.debug("get cluster called with cluster_name: {}", clusterName);
    try {
      Cluster cluster = context.storage.getCluster(clusterName);

      String jmxUsername = "";
      boolean jmxPasswordIsSet = false;

      Optional<JmxCredentials> jmxCredentials = context.jmxConnectionFactory
              .getJmxCredentialsForCluster(Optional.ofNullable(cluster));
      if (jmxCredentials.isPresent()) {
        jmxUsername = StringUtils.trimToEmpty(jmxCredentials.get().getUsername());
        jmxPasswordIsSet = !StringUtils.isEmpty(jmxCredentials.get().getPassword());
      }

      ClusterStatus clusterStatus = new ClusterStatus(
            cluster,
            jmxUsername,
            jmxPasswordIsSet,
            context.storage.getClusterRunStatuses(cluster.getName(), limit.orElse(Integer.MAX_VALUE)),
            context.storage.getClusterScheduleStatuses(cluster.getName()),
            getNodesStatus(cluster));

      return Response.ok().entity(clusterStatus).build();
    } catch (IllegalArgumentException ignore) { }
    return Response.status(404).entity("cluster with name \"" + clusterName + "\" not found").build();
  }

  public  ClusterResource(AppContext context, Cryptograph cryptograph, ExecutorService executor);

}