Package com.amazonaws.services.elasticbeanstalk.model

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


  @MojoParameter(expression = "${beanstalk.targetEnvironmentCNamePrefix}", description = "CName of target environment")
  String targetEnvironmentCNamePrefix;

  @Override
  protected Object executeInternal() throws AbstractMojoExecutionException {
    EnvironmentDescription sourceEnvironment = lookupEnvironment(applicationName,
        "source", sourceEnvironmentId,
        sourceEnvironmentName, sourceEnvironmentCNamePrefix);
    EnvironmentDescription targetEnvironment = lookupEnvironment(applicationName,
        "target", targetEnvironmentId,
        targetEnvironmentName, targetEnvironmentCNamePrefix);

    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

    @MojoParameter(expression="${beanstalk.cnamePrefix}", description = "cnamePrefix")
    protected String cnamePrefix;

  @Override
  protected void configure() {
    EnvironmentDescription envSpec = null;
   
    try {
      envSpec = super.lookupEnvironment(applicationName, "", environmentId, environmentName, cnamePrefix);
    } catch (MojoExecutionException e) {
      throw new RuntimeException(e);
    }
   
    this.environmentId = envSpec.getEnvironmentId();
    this.environmentName = envSpec.getEnvironmentName();
  }
View Full Code Here

        .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

            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

        .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

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

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

    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

    }

    /*
     * 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);
   
    if (! solutionStack.equals(curEnv.getSolutionStackName())) {
      if (getLog().isInfoEnabled())
        getLog().info(
            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
       */
      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

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

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

    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

    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

TOP

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

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.