/** Use the native EC2 discovery module on AWS */
 private static void addDefaultsForEC2(ClusterSpec spec, CompositeConfiguration config) {
   config.addProperty("es.discovery.type", "ec2");
   if (!config.containsKey("es.cloud.aws.access_key")) {
     config.addProperty("es.cloud.aws.access_key", spec.getIdentity());
   }
   if (!config.containsKey("es.cloud.aws.secret_key")) {
     config.addProperty("es.cloud.aws.secret_key", spec.getCredential());
   }
   if (!config.getList("es.plugins", Lists.newLinkedList()).contains("cloud-aws")) {
     config.addProperty("es.plugins", "cloud-aws");
   }
 }
  /** Build a configuration by adding the expected defaults */
  public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) {
    CompositeConfiguration config = new CompositeConfiguration();

    config.addConfiguration(spec.getConfiguration());
    try {
      config.addConfiguration(
          new PropertiesConfiguration("whirr-elasticsearch-default.properties"));
    } catch (ConfigurationException e) {
      LOG.error("Configuration error", e); // this should never happen
    }

    if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) {
      addDefaultsForEC2(spec, config);
    } else {
      addDefaultsForUnicast(cluster, config);
    }
    if (!config.containsKey("es.cluster.name")) {
      config.addProperty("es.cluster.name", spec.getClusterName());
    }

    return config;
  }
 @Override
 public boolean containsKey(String key) {
   return config.containsKey(key);
 }