Examples of EnvironmentDescription


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

    }

    /*
     * Gets the current environment using this cname
     */
    EnvironmentDescription curEnv = getEnvironmentFor(applicationName,
        cnamePrefix);

    if (curEnv.getVersionLabel().equals(versionLabel) && skipIfSameVersion) {
      getLog().warn(format("Environment is running version %s and skipIfSameVersion is true. Returning", versionLabel));

      return null;
    }

    /*
     * Decides on a cnamePrefix, and launches a new environment
     */
    String cnamePrefixToCreate = getCNamePrefixToCreate();

    if (getLog().isInfoEnabled())
      getLog().info(
          "Creating a new environment on " + cnamePrefixToCreate
              + ".elasticbeanstalk.com");

    copyOptionSettings(curEnv);

    if (!solutionStack.equals(curEnv.getSolutionStackName())) {
      if (getLog().isInfoEnabled())
        getLog().warn(
            format("(btw, we're launching with solutionStack/ set to '%s' instead of the default ('%s'). " +
                "If this is not the case, then we kindly ask you to file a bug report on the mailing list :)",
                curEnv.getSolutionStackName(), solutionStack));

      solutionStack = curEnv.getSolutionStackName();
    }

    String newEnvironmentName = getNewEnvironmentName(this.environmentName);

    if (getLog().isInfoEnabled())
      getLog().info("And it'll be named " + newEnvironmentName);

    CreateEnvironmentResult createEnvResult = createEnvironment(
        cnamePrefixToCreate, newEnvironmentName);

    /*
     * Waits for completion
     */
    EnvironmentDescription newEnvDesc = null;

    try {
      newEnvDesc = waitForEnvironment(createEnvResult.getEnvironmentId());
    } catch (Exception exc) {
      /*
       * Terminates the failed launched environment
       */
      terminateEnvironment(createEnvResult.getEnvironmentId());

      handleException(exc);

      return null;
    }

    /*
     * Swaps. Due to beanstalker-25, we're doing some extra logic we
     * actually woudln't want to.
     */
    {
      boolean swapped = false;
      for (int i = 1; i <= maxAttempts; i++) {
        try {
          swapEnvironmentCNames(newEnvDesc.getEnvironmentId(),
              curEnv.getEnvironmentId(), cnamePrefix);
          swapped = true;
          break;
        } catch (Throwable exc) {
          if (exc instanceof MojoFailureException)
            exc = Throwable.class.cast(MojoFailureException.class.cast(exc).getCause());

          getLog().warn(format("Attempt #%d/%d failed. Sleeping and retrying. Reason: %s", i, maxAttempts, exc.getMessage()));

          sleepInterval(attemptRetryInterval);
        }
      }

      if (!swapped) {
        getLog().info("Failed to properly Replace Environment. Finishing the new one. And throwing you a failure");

        terminateEnvironment(newEnvDesc.getEnvironmentId());

        String message = "Unable to swap cnames. btw, see https://github.com/ingenieux/beanstalker/issues/25 and help us improve beanstalker";

        getLog().warn(message);

View Full Code Here

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

  @Parameter(property="beanstalk.targetEnvironmentCNamePrefix")
  String targetEnvironmentCNamePrefix;

  @Override
  protected Object executeInternal() throws AbstractMojoExecutionException {
    EnvironmentDescription sourceEnvironment = lookupEnvironment(applicationName,
        sourceEnvironmentCNamePrefix, null);
    EnvironmentDescription targetEnvironment = lookupEnvironment(applicationName,
        targetEnvironmentCNamePrefix, null);

    SwapCNamesContext context = SwapCNamesContextBuilder
        .swapCNamesContext()//
        .withSourceEnvironmentId(sourceEnvironment.getEnvironmentId())//
        .withSourceEnvironmentName(
            sourceEnvironment.getEnvironmentName())//
        .withDestinationEnvironmentId(
            targetEnvironment.getEnvironmentId())//
        .withDestinationEnvironmentName(
            targetEnvironment.getEnvironmentName())//
        .build();
   
    SwapCNamesCommand command = new SwapCNamesCommand(this);

    return command.execute(context);
View Full Code Here

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

    }

    /*
     * Gets the current environment using this cname
     */
    EnvironmentDescription curEnv = getEnvironmentFor(applicationName,
        cnamePrefix);

    if (curEnv.getVersionLabel().equals(versionLabel) && skipIfSameVersion) {
      getLog().warn(
          format("Environment is running version %s and skipIfSameVersion is true. Returning",
              versionLabel));

      return null;
    }

    /*
     * Decides on a cnamePrefix, and launches a new environment
     */
    String cnamePrefixToCreate = getCNamePrefixToCreate();

    if (getLog().isInfoEnabled())
      getLog().info(
          "Creating a new environment on " + cnamePrefixToCreate
              + ".elasticbeanstalk.com");

    copyOptionSettings(curEnv);

    if (!solutionStack.equals(curEnv.getSolutionStackName())) {
      if (getLog().isInfoEnabled())
        getLog().warn(
            format("(btw, we're launching with solutionStack/ set to '%s' instead of the default ('%s'). "
                + "If this is not the case, then we kindly ask you to file a bug report on the mailing list :)",
                curEnv.getSolutionStackName(), solutionStack));

      solutionStack = curEnv.getSolutionStackName();
    }

    String newEnvironmentName = getNewEnvironmentName(StringUtils
        .defaultString(this.environmentName,
            curEnv.getEnvironmentName()));

    if (getLog().isInfoEnabled())
      getLog().info("And it'll be named " + newEnvironmentName);

    CreateEnvironmentResult createEnvResult = createEnvironment(
        cnamePrefixToCreate, newEnvironmentName);

    /*
     * Waits for completion
     */
    EnvironmentDescription newEnvDesc = null;

    try {
      newEnvDesc = waitForEnvironment(createEnvResult.getEnvironmentId());
    } catch (Exception exc) {
      /*
       * Terminates the failed launched environment
       */
      terminateEnvironment(createEnvResult.getEnvironmentId());

      handleException(exc);

      return null;
    }

    /*
     * Swaps. Due to beanstalker-25, we're doing some extra logic we
     * actually woudln't want to.
     */
    {
      boolean swapped = false;
      for (int i = 1; i <= maxAttempts; i++) {
        try {
          swapEnvironmentCNames(newEnvDesc.getEnvironmentId(),
              curEnv.getEnvironmentId(), cnamePrefix);
          swapped = true;
          break;
        } catch (Throwable exc) {
          if (exc instanceof MojoFailureException)
            exc = Throwable.class.cast(MojoFailureException.class
                .cast(exc).getCause());

          getLog().warn(
              format("Attempt #%d/%d failed. Sleeping and retrying. Reason: %s",
                  i, maxAttempts, exc.getMessage()));

          sleepInterval(attemptRetryInterval);
        }
      }

      if (!swapped) {
        getLog().info(
            "Failed to properly Replace Environment. Finishing the new one. And throwing you a failure");

        terminateEnvironment(newEnvDesc.getEnvironmentId());

        String message = "Unable to swap cnames. btw, see https://github.com/ingenieux/beanstalker/issues/25 and help us improve beanstalker";

        getLog().warn(message);

View Full Code Here

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

    }

    /*
     * Gets the current environment using this cname
     */
    EnvironmentDescription curEnv = getEnvironmentFor(applicationName,
        cnamePrefix);

    /*
     * Decides on a cnamePrefix, and launches a new environment
     */
    String cnamePrefixToCreate = getCNamePrefixToCreate();

    if (getLog().isInfoEnabled())
      getLog().info(
          "Creating a new environment on " + cnamePrefixToCreate
              + ".elasticbeanstalk.com");

    CreateEnvironmentResult createEnvResult = createEnvironment(cnamePrefixToCreate);

    /*
     * Waits for completion
     */
    EnvironmentDescription newEnvDesc = null;

    try {
      newEnvDesc = waitForEnvironment(createEnvResult.getEnvironmentId());
    } catch (Exception exc) {
      /*
       * Terminates the failed launched environment
       */
      terminateAndWaitForEnvironment(createEnvResult.getEnvironmentId());

      handleException(exc);

      return null;
    }

    /*
     * Swaps
     */
    swapEnvironmentCNames(newEnvDesc.getEnvironmentId(),
        curEnv.getEnvironmentId(), cnamePrefix);

    /*
     * Terminates the previous environment - and waits for it
     */
 
View Full Code Here

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

        .getEnvironments();

    if (environmentList.isEmpty())
      throw new MojoFailureException("No environments were found");

    EnvironmentDescription d = environmentList.get(0);

    Collections.sort(appVersionList,
        new Comparator<ApplicationVersionDescription>() {
          @Override
          public int compare(ApplicationVersionDescription o1,
              ApplicationVersionDescription o2) {
            return new CompareToBuilder().append(o1.getDateUpdated(),
                o2.getDateUpdated()).toComparison();
          }
        });

    Collections.reverse(appVersionList);
   
    if (latestVersionInstead) {
      ApplicationVersionDescription latestVersionDescription = appVersionList
          .get(0);

      return changeToVersion(d, latestVersionDescription);
    }

    ListIterator<ApplicationVersionDescription> versionIterator = appVersionList
        .listIterator();

    String curVersionLabel = d.getVersionLabel();

    while (versionIterator.hasNext()) {
      ApplicationVersionDescription versionDescription = versionIterator.next();

      String versionLabel = versionDescription.getVersionLabel();
View Full Code Here

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

    if (environmentsFor.isEmpty()) {
      getLog().info(
          "No running environments found. Assigning defaultEnvironmentName");
      this.environmentName = defaultEnvironmentName;
    } else if (1 == environmentsFor.size()) {
      EnvironmentDescription env = environmentsFor.iterator().next();
     
      getLog().info(
          "Assigning a environment named " + env.getEnvironmentName());
     
      //this.environmentId = envId;
      this.environmentName = env.getEnvironmentName();
    } else {
      getLog()
          .info(
              "Too many running environments found. Will not pick one. Declare -Dbeanstalk.environmentName next time.");
    }
View Full Code Here

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

    }

    /*
     * Gets the current environment using this cname
     */
    EnvironmentDescription curEnv = getEnvironmentFor(applicationName,
        cnamePrefix);

    /*
     * Decides on a cnamePrefix, and launches a new environment
     */
    String cnamePrefixToCreate = getCNamePrefixToCreate();

    if (getLog().isInfoEnabled())
      getLog().info(
          "Creating a new environment on " + cnamePrefixToCreate
              + ".elasticbeanstalk.com");

    copyOptionSettings(curEnv);

    String newEnvironmentName = getNewEnvironmentName(this.environmentName);

    if (getLog().isInfoEnabled())
      getLog().info("And it'll be named " + newEnvironmentName);

    CreateEnvironmentResult createEnvResult = createEnvironment(
        cnamePrefixToCreate, newEnvironmentName);

    /*
     * Waits for completion
     */
    EnvironmentDescription newEnvDesc = null;

    try {
      newEnvDesc = waitForEnvironment(createEnvResult.getEnvironmentId());
    } catch (Exception exc) {
      /*
       * Terminates the failed launched environment
       */
      terminateAndWaitForEnvironment(createEnvResult.getEnvironmentId());

      handleException(exc);

      return null;
    }

    /*
     * Swaps
     */
    swapEnvironmentCNames(newEnvDesc.getEnvironmentId(),
        curEnv.getEnvironmentId(), cnamePrefix);

    /*
     * Terminates the previous environment - and waits for it
     */
 
View Full Code Here

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

        .getEnvironments();

    if (environmentList.isEmpty())
      throw new MojoFailureException("No environments were found");

    EnvironmentDescription d = environmentList.get(0);

    Collections.sort(appVersionList,
        new Comparator<ApplicationVersionDescription>() {
          @Override
          public int compare(ApplicationVersionDescription o1,
              ApplicationVersionDescription o2) {
            return new CompareToBuilder().append(o1.getDateUpdated(),
                o2.getDateUpdated()).toComparison();
          }
        });

    Collections.reverse(appVersionList);
   
    if (latestVersionInstead) {
      ApplicationVersionDescription latestVersionDescription = appVersionList
          .get(0);

      return changeToVersion(d, latestVersionDescription);
    }

    ListIterator<ApplicationVersionDescription> versionIterator = appVersionList
        .listIterator();

    String curVersionLabel = d.getVersionLabel();

    while (versionIterator.hasNext()) {
      ApplicationVersionDescription versionDescription = versionIterator.next();

      String versionLabel = versionDescription.getVersionLabel();
View Full Code Here

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

        .getEnvironments();

    if (environmentList.isEmpty())
      throw new MojoFailureException("No environments were found");

    EnvironmentDescription d = environmentList.get(0);

    Collections.sort(appVersionList,
        new Comparator<ApplicationVersionDescription>() {
          @Override
          public int compare(ApplicationVersionDescription o1,
              ApplicationVersionDescription o2) {
            return new CompareToBuilder().append(o1.getDateUpdated(),
                o2.getDateUpdated()).toComparison();
          }
        });

    Collections.reverse(appVersionList);
   
    if (latestVersionInstead) {
      ApplicationVersionDescription latestVersionDescription = appVersionList
          .get(0);

      return changeToVersion(d, latestVersionDescription);
    }

    ListIterator<ApplicationVersionDescription> versionIterator = appVersionList
        .listIterator();

    String curVersionLabel = d.getVersionLabel();

    while (versionIterator.hasNext()) {
      ApplicationVersionDescription versionDescription = versionIterator.next();

      String versionLabel = versionDescription.getVersionLabel();
View Full Code Here

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

            Collection<EnvironmentDescription> validEnvironments = Collections2.filter(envs, envPredicate);

      debug("There are %d environments", validEnvironments.size());

      if (1 == validEnvironments.size()) {
        EnvironmentDescription foundEnvironment = validEnvironments.iterator()
            .next();
       
        debug("Found environment %s", foundEnvironment);

        return foundEnvironment;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.