<commit_before>package com.meltmedia.jgroups.aws;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;

@JsonIgnoreProperties(ignoreUnknown = true)
public class InstanceIdentity {
  private static String INSTANCE_IDENTITY_URL = "http://instance-data/latest/dynamic/instance-identity/document";
  private static URI INSTANCE_IDENTITY_URI;

  static {
    try {
      INSTANCE_IDENTITY_URI = new URI(INSTANCE_IDENTITY_URL);
    } catch (URISyntaxException e) {
      throw new RuntimeException("this should never happen");
    }
  }


  public final String availabilityZone;
  public final String privateIp;
  public final String instanceId;
  public final String instanceType;
  public final String imageId;
  public final String architecture;
  public final String region;

  public InstanceIdentity(
      @JsonProperty("availabilityZone") final String availabilityZone,
      @JsonProperty("privateIp") final String privateIp,
      @JsonProperty("instanceId") final String instanceId,
      @JsonProperty("instanceType") final String instanceType,
      @JsonProperty("imageId") final String imageId,<commit_msg>Adding support for system property to configure instance data and defaulting to ip value instead of name to avoid host resolution<commit_after>package com.meltmedia.jgroups.aws;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;

@JsonIgnoreProperties(ignoreUnknown = true)
public class InstanceIdentity {

  private static final String INSTANCE_DATA  = System.getProperty("instance.data", "169.254.169.254");
  private static final String INSTANCE_IDENTITY_URL = String.format("http://%s/latest/dynamic/instance-identity/document", INSTANCE_DATA);

  private static URI INSTANCE_IDENTITY_URI;

  static {
    try {
      INSTANCE_IDENTITY_URI = new URI(INSTANCE_IDENTITY_URL);
    } catch (URISyntaxException e) {
      throw new RuntimeException("this should never happen");
    }
  }


  public final String availabilityZone;
  public final String privateIp;
  public final String instanceId;
  public final String instanceType;
  public final String imageId;
  public final String architecture;
  public final String region;

  public InstanceIdentity(
      @JsonProperty("availabilityZone") final String availabilityZone,
      @JsonProperty("privateIp") final String privateIp,
      @JsonProperty("instanceId") final String instanceId,
      @JsonProperty("instanceType") final String instanceType,
      @JsonProperty("imageId") final String imageId,
{'fraction_non_alphanumeric': 0.08453237410071943, 'fraction_numerical': 0.0035971223021582736, 'mean_word_length': 5.21415270018622, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 1, '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': '373064', 'n_tokens_mistral': 932, 'n_tokens_neox': 893, 'n_words': 236}