Package com.amazonaws.services.elasticbeanstalk.model

Examples of com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionSetting


    ListIterator<ConfigurationOptionSetting> listIterator = newOptionSettings
        .listIterator();

    while (listIterator.hasNext()) {
      ConfigurationOptionSetting curOptionSetting = listIterator.next();

      boolean bInvalid = harmfulOptionSettingP(curEnv
          .getEnvironmentId(), curOptionSetting);

      if (bInvalid) {
        getLog().info(format("Excluding Option Setting: %s:%s['%s']", curOptionSetting.getNamespace(), curOptionSetting.getOptionName(), CredentialsUtil.redact(curOptionSetting.getValue())));
        listIterator.remove();
      } else {
        getLog().info(format("Including Option Setting: %s:%s['%s']", curOptionSetting.getNamespace(), curOptionSetting.getOptionName(), CredentialsUtil.redact(curOptionSetting.getValue())));
      }
    }

    /*
     * Then copy it back
View Full Code Here


        getLog().info(
            "importing " + k + " as " + namespace + ":"
                + optionName + "=" + v);

        configOptionSetting.add(new ConfigurationOptionSetting()
            .withNamespace(namespace).withOptionName(optionName)
            .withValue(v));
      } else if (COMMON_PARAMETERS.containsKey(k)) {
        String v = "" + properties.get(k);
        String namespace = COMMON_PARAMETERS.get(k).getNamespace();
        String optionName = COMMON_PARAMETERS.get(k).getOptionName();

        getLog().info(
            "Found alias " + k + " for " + namespace + ":"
                + optionName + "(value=" + v + ")");

        configOptionSetting.add(new ConfigurationOptionSetting()
            .withNamespace(namespace).withOptionName(optionName)
            .withValue(v));
      }
    }
View Full Code Here

    ListIterator<ConfigurationOptionSetting> listIterator = newOptionSettings
        .listIterator();

    while (listIterator.hasNext()) {
      ConfigurationOptionSetting curOptionSetting = listIterator.next();

      boolean bInvalid = harmfulOptionSettingP(curEnv.getEnvironmentId(),
          curOptionSetting);

      if (bInvalid) {
        getLog().info(
            format("Excluding Option Setting: %s:%s['%s']",
                curOptionSetting.getNamespace(),
                curOptionSetting.getOptionName(),
                CredentialsUtil.redact(curOptionSetting
                    .getValue())));
        listIterator.remove();
      } else {
        getLog().info(
            format("Including Option Setting: %s:%s['%s']",
                curOptionSetting.getNamespace(),
                curOptionSetting.getOptionName(),
                CredentialsUtil.redact(curOptionSetting
                    .getValue())));
      }
    }

    Object __secGroups = project.getProperties().get(
        "beanstalk.securityGroups");

    if (null != __secGroups) {
      String securityGroups = StringUtils.defaultString(__secGroups.toString());

      if (!StringUtils.isBlank(securityGroups)) {
        ConfigurationOptionSetting newOptionSetting = new ConfigurationOptionSetting(
            "aws:autoscaling:launchconfiguration",
            "SecurityGroups", securityGroups);
        newOptionSettings.add(newOptionSetting);
        getLog().info(
            format("Including Option Setting: %s:%s['%s']",
                newOptionSetting.getNamespace(),
                newOptionSetting.getOptionName(),
                newOptionSetting.getValue()));
      }
    }

    /*
     * Then copy it back
View Full Code Here

    ListIterator<ConfigurationOptionSetting> listIterator = newOptionSettings
        .listIterator();

    while (listIterator.hasNext()) {
      ConfigurationOptionSetting curOptionSetting = listIterator.next();

      /*
       * Filters out harmful options
       *
       * I really mean harmful - If you mention a terminated environment
       * settings, Elastic Beanstalk will accept, but this might lead to
       * inconsistent states, specially when creating / listing environments.
       *
       * Trust me on this one.
       */
      boolean bInvalid = isBlank(curOptionSetting.getValue());

      if (!bInvalid)
        bInvalid |= (curOptionSetting.getNamespace().equals(
            "aws:cloudformation:template:parameter") && curOptionSetting
            .getOptionName().equals("AppSource"));

      if (!bInvalid)
        bInvalid |= (curOptionSetting.getValue().contains(curEnv
            .getEnvironmentId()));

      if (bInvalid)
        listIterator.remove();
    }
View Full Code Here

        getLog().info(
            "importing " + k + " as " + namespace + ":"
                + optionName + "=" + v);

        configOptionSetting.add(new ConfigurationOptionSetting()
            .withNamespace(namespace).withOptionName(optionName)
            .withValue(v));
      } else if (COMMON_PARAMETERS.containsKey(k)) {
        String v = "" + properties.get(k);
        String namespace = COMMON_PARAMETERS.get(k).getNamespace();
        String optionName = COMMON_PARAMETERS.get(k).getOptionName();

        getLog().info(
            "Found alias " + k + " for " + namespace + ":"
                + optionName + "(value=" + v + ")");

        configOptionSetting.add(new ConfigurationOptionSetting()
            .withNamespace(namespace).withOptionName(optionName)
            .withValue(v));
      }
    }
View Full Code Here

    waitForNotUpdating();

    UpdateEnvironmentRequest req = new UpdateEnvironmentRequest()
        .withEnvironmentId(curEnv.getEnvironmentId());

    req.setOptionSettings(Arrays.asList(new ConfigurationOptionSetting()
        .withNamespace("aws:elasticbeanstalk:application:environment")
        .withOptionName(envName).withValue(envValue)));

    UpdateEnvironmentResult result = getService().updateEnvironment(req);
View Full Code Here

      String key = String.format("beanstalk.env.%s.%s", o.getNamespace()
          .replace(":", "."), o.getName());

      for (Map.Entry<String, ConfigurationOptionSetting> entry : COMMON_PARAMETERS
          .entrySet()) {
        ConfigurationOptionSetting cos = entry.getValue();

        if (cos.getNamespace().equals(o.getNamespace())
            && cos.getOptionName().equals(o.getName())) {
          key = entry.getKey();
          break;
        }
      }

      defaultSettings.put(key, o);
    }

    DescribeConfigurationSettingsResult configurationSettings = getService()
        .describeConfigurationSettings(
            new DescribeConfigurationSettingsRequest()
                .withApplicationName(applicationName)
                .withEnvironmentName(
                    curEnv.getEnvironmentName()));

    Properties newProperties = new Properties();

    if (configurationSettings.getConfigurationSettings().isEmpty()) {
      throw new IllegalStateException(
          "No Configuration Settings received");
    }

    ConfigurationSettingsDescription configSettings = configurationSettings
        .getConfigurationSettings().get(0);
   
    Map<String, ConfigurationOptionSetting> keyMap = new LinkedHashMap<String, ConfigurationOptionSetting>();

    for (ConfigurationOptionSetting d : configSettings.getOptionSettings()) {
      String key = String.format("beanstalk.env.%s.%s", d.getNamespace()
          .replaceAll(":", "."), d.getOptionName());
      String defaultValue = "";
      String outputKey = key;
     
      keyMap.put(key, d);

      for (Map.Entry<String, ConfigurationOptionSetting> cosEntry : COMMON_PARAMETERS
          .entrySet()) {
        ConfigurationOptionSetting v = cosEntry.getValue();

        boolean match = v.getNamespace().equals(d.getNamespace())
            && v.getOptionName().equals(d.getOptionName());

        if (match) {
          outputKey = cosEntry.getKey();
          break;
        }
      }

      if (defaultSettings.containsKey(outputKey))
        defaultValue = StringUtils.defaultString(defaultSettings.get(
            outputKey).getDefaultValue());

      String value = d.getValue();

      if (null == value || StringUtils.isBlank("" + value))
        continue;

      if (!defaultValue.equals(value)) {
        if (!value.contains(curEnv.getEnvironmentId())) {
          getLog().info("Adding property " + key);

          if (changedOnly) {
            String curValue = project.getProperties().getProperty(
                outputKey);

            if (!value.equals(curValue)) {
              newProperties.put(outputKey, value);
            }
          } else {
            newProperties.put(outputKey, value);
          }
        } else {
          getLog().info(
              "Ignoring property "
                  + outputKey
                  + "(value="
                  + value
                  + ") due to containing references to the environment id");
        }

      } else {
        getLog().debug("Ignoring property " + key + " (defaulted)");
      }
    }

    if ("properties".equals(this.outputFileFormat)) {
      String comment = "elastic beanstalk environment properties for "
          + curEnv.getEnvironmentName();
      if (null != outputFile) {
        newProperties.store(new FileOutputStream(outputFile), comment);
      } else {
        newProperties.store(System.out, comment);
      }
    } else if ("yaml".equals(this.outputFileFormat)) {
      PrintStream printStream = System.out;
     
      if (null != outputFile)
        printStream = new PrintStream(outputFile);
     
      printStream.println("option_settings:");
     
      for (Map.Entry<Object, Object> e : newProperties.entrySet()) {
        ConfigurationOptionSetting c = keyMap.get("" + e.getKey());
        String value = "" + e.getValue();
       
        printStream.println("  - namespace: " + c.getNamespace());
        printStream.println("    option_name: " + c.getOptionName());
        printStream.println("    value: " + value);
      }
     
      printStream.close();
    }
View Full Code Here

  protected Object executeInternal() throws Exception {
    UpdateEnvironmentRequest req = new UpdateEnvironmentRequest()
        .withEnvironmentId(curEnv.getEnvironmentId());

    req.setOptionSettings(Arrays.asList(new ConfigurationOptionSetting()
        .withNamespace("aws:elasticbeanstalk:application:environment")
        .withOptionName(envName).withValue(envValue)));

    UpdateEnvironmentResult result = getService().updateEnvironment(req);
View Full Code Here

      String key = String.format("beanstalk.env.%s.%s", o.getNamespace()
          .replace(":", "."), o.getName());

      for (Map.Entry<String, ConfigurationOptionSetting> entry : COMMON_PARAMETERS
          .entrySet()) {
        ConfigurationOptionSetting cos = entry.getValue();

        if (cos.getNamespace().equals(o.getNamespace())
            && cos.getOptionName().equals(o.getName())) {
          key = entry.getKey();
          break;
        }
      }

      defaultSettings.put(key, o);
    }

    DescribeConfigurationSettingsResult configurationSettings = getService()
        .describeConfigurationSettings(
            new DescribeConfigurationSettingsRequest()
                .withApplicationName(applicationName)
                .withEnvironmentName(
                    curEnv.getEnvironmentName()));

    Properties newProperties = new Properties();

    if (configurationSettings.getConfigurationSettings().isEmpty()) {
      throw new IllegalStateException(
          "No Configuration Settings received");
    }

    ConfigurationSettingsDescription configSettings = configurationSettings
        .getConfigurationSettings().get(0);

    for (ConfigurationOptionSetting d : configSettings.getOptionSettings()) {
      String key = String.format("beanstalk.env.%s.%s", d.getNamespace()
          .replaceAll(":", "."), d.getOptionName());
      String defaultValue = "";
      String outputKey = key;

      for (Map.Entry<String, ConfigurationOptionSetting> cosEntry : COMMON_PARAMETERS
          .entrySet()) {
        ConfigurationOptionSetting v = cosEntry.getValue();

        boolean match = v.getNamespace().equals(d.getNamespace())
            && v.getOptionName().equals(d.getOptionName());

        if (match) {
          outputKey = cosEntry.getKey();
          break;
        }
View Full Code Here

        getLog().info(
            "importing " + k + " as " + namespace + ":"
                + optionName + "=" + v);

        configOptionSetting.add(new ConfigurationOptionSetting()
            .withNamespace(namespace).withOptionName(optionName)
            .withValue(v));
      } else if (COMMON_PARAMETERS.containsKey(k)) {
        String v = "" + properties.get(k);
        String namespace = COMMON_PARAMETERS.get(k).getNamespace();
        String optionName = COMMON_PARAMETERS.get(k).getOptionName();

        getLog().info(
            "Found alias " + k + " for " + namespace + ":"
                + optionName + "(value=" + v + ")");

        configOptionSetting.add(new ConfigurationOptionSetting()
            .withNamespace(namespace).withOptionName(optionName)
            .withValue(v));
      }
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionSetting

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.