<commit_before>package com.hubspot.baragon.service.resources;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.hubspot.baragon.data.BaragonLoadBalancerDatastore;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Collection;

@Path("/load-balancer")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class LoadBalancerResource {
  private final BaragonLoadBalancerDatastore datastore;

  @Inject
  public LoadBalancerResource(BaragonLoadBalancerDatastore datastore) {
    this.datastore = datastore;
  }

  @GET
  public Collection<String> getClusters() {
    return datastore.getClusters();
  }
  
  @GET
  @Path("/{clusterName}/hosts")
  public Collection<String> getHosts(@PathParam("clusterName") String clusterName) {
    return datastore.getBaseUrls(clusterName);
  }

  @GET
  @Path("/{clusterName}/base-path/all")
  public Collection<String> getBasePaths(@PathParam("clusterName") String clusterName) {
    return datastore.getBasePaths(clusterName);
  }

  @GET
  @Path("/{clusterName}/base-path")
  public Optional<String> getBasePathServiceId(@PathParam("clusterName") String clusterName, @QueryParam("basePath") String basePath) {
    return datastore.getBasePathServiceId(clusterName, basePath);
  }

  @DELETE
  @Path("/{clusterName}/base-path")
  public void clearBasePath(@PathParam("clusterName") String clusterName, @QueryParam("basePath") String basePath) {
    datastore.clearBasePath(clusterName, basePath);
  }
}
<commit_msg>tweak<commit_after>package com.hubspot.baragon.service.resources;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.hubspot.baragon.data.BaragonLoadBalancerDatastore;
import com.hubspot.baragon.data.BaragonStateDatastore;
import com.hubspot.baragon.models.Service;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Collection;

@Path("/load-balancer")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class LoadBalancerResource {
  private final BaragonLoadBalancerDatastore loadBalancerDatastore;
  private final BaragonStateDatastore stateDatastore;

  @Inject
  public LoadBalancerResource(BaragonLoadBalancerDatastore loadBalancerDatastore,
                              BaragonStateDatastore stateDatastore) {
    this.loadBalancerDatastore = loadBalancerDatastore;
    this.stateDatastore = stateDatastore;
  }

  @GET
  public Collection<String> getClusters() {
    return loadBalancerDatastore.getClusters();
  }
  
  @GET
  @Path("/{clusterName}/hosts")
  public Collection<String> getHosts(@PathParam("clusterName") String clusterName) {
    return loadBalancerDatastore.getBaseUrls(clusterName);
  }

  @GET
  @Path("/{clusterName}/base-path/all")
  public Collection<String> getBasePaths(@PathParam("clusterName") String clusterName) {
    return loadBalancerDatastore.getBasePaths(clusterName);
  }

  @GET
  @Path("/{clusterName}/base-path")
  public Optional<Service> getBasePathServiceId(@PathParam("clusterName") String clusterName, @QueryParam("basePath") String basePath) {
    final Optional<String> maybeServiceId = loadBalancerDatastore.getBasePathServiceId(clusterName, basePath);

    if (!maybeServiceId.isPresent()) {
      return Optional.absent();
    }

    return stateDatastore.getService(maybeServiceId.get());
  }

  @DELETE
  @Path("/{clusterName}/base-path")
  public void clearBasePath(@PathParam("clusterName") String clusterName, @QueryParam("basePath") String basePath) {
    loadBalancerDatastore.clearBasePath(clusterName, basePath);
  }
}

{'fraction_non_alphanumeric': 0.11424619640387275, 'fraction_numerical': 0.0, 'mean_word_length': 5.746268656716418, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2774790', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1124, 'n_words': 178}