Package org.jclouds.compute

Examples of org.jclouds.compute.ComputeService.templateBuilder()


      requestResponseMap.put(requestSpotInstancesRequest, requestSpotInstancesResponse);
      requestResponseMap.put(describeSpotInstanceRequest, describeSpotInstanceResponse);

      ComputeService createsSpotInstance = requestsSendResponses(requestResponseMap.build());

      Template template = createsSpotInstance.templateBuilder().locationId("us-east-1a").build();

      template.getOptions().as(AWSEC2TemplateOptions.class).spotPrice(1f).iamInstanceProfileName("Webserver")
            .noKeyPair().blockUntilRunning(false);

      NodeMetadata node = Iterables.getOnlyElement(createsSpotInstance.createNodesInGroup("test", 1, template));
View Full Code Here


   public void testDefaultTemplateOpenStack() throws Exception {

      ComputeService apiForOpenStack = requestsSendResponses(defaultTemplateOpenStack);

      Template defaultTemplate = apiForOpenStack.templateBuilder().imageId("RegionOne/15").build();
      checkTemplate(defaultTemplate);
      checkTemplate(apiForOpenStack.templateBuilder().fromTemplate(defaultTemplate).build());

   }
View Full Code Here

      ComputeService apiForOpenStack = requestsSendResponses(defaultTemplateOpenStack);

      Template defaultTemplate = apiForOpenStack.templateBuilder().imageId("RegionOne/15").build();
      checkTemplate(defaultTemplate);
      checkTemplate(apiForOpenStack.templateBuilder().fromTemplate(defaultTemplate).build());

   }

   private void checkTemplate(Template defaultTemplate) {
      assertEquals(defaultTemplate.getImage().getId(), "RegionOne/15");
View Full Code Here

      } catch (Throwable t) {
         System.err.println(t.getMessage());
         return null;
      }

      TemplateBuilder builder = service.templateBuilder();
      builder.any();
      if (smallest) {
         builder.smallest();
      }
      if (fastest) {
View Full Code Here

         case ADD:
            System.out.printf(">> adding node to group %s%n", groupName);

            // Default template chooses the smallest size on an operating system
            // that tested to work with java, which tends to be Ubuntu or CentOS
            TemplateBuilder templateBuilder = compute.templateBuilder();
           
            // If you want to up the ram and leave everything default, you can
            // just tweak minRam
            if (minRam != null)
               templateBuilder.minRam(Integer.parseInt(minRam));
View Full Code Here

               System.out.printf(">> adding node to group %s%n", groupName);

               // Default template chooses the smallest size on an operating
               // system that tested to work with java, which tends to be Ubuntu
               // or CentOS
               TemplateBuilder templateBuilder = compute.templateBuilder();

               // If you want to up the ram and leave everything default, you
               // can just tweak minRam
               if (minRam != null) {
                  templateBuilder.minRam(Integer.parseInt(minRam));
View Full Code Here

      RetryablePredicate<IPSocket> socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 60,
               1, 1, TimeUnit.SECONDS);
      try {
         if (command.equals("create")) {

            Template template = compute.templateBuilder().build();

            template.getOptions().as(AWSEC2TemplateOptions.class)
            // set the price as 3 cents/hr
                     .spotPrice(0.03f)
                     // authorize my ssh key
View Full Code Here

    ComputeServiceContext context = mock(ComputeServiceContext.class);
    when(computeService.getContext()).thenReturn(context);
    when(context.getComputeService()).thenReturn(computeService);

    TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
    when(computeService.templateBuilder()).thenReturn(templateBuilder);
    when(templateBuilder.from((TemplateBuilderSpec)any())).thenReturn(templateBuilder);
    when(templateBuilder.options((TemplateOptions)any())).thenReturn(templateBuilder);

    Template template = mock(Template.class);
    TemplateOptions options = mock(TemplateOptions.class);
View Full Code Here

      requestResponseMap.put(requestSpotInstancesRequest, requestSpotInstancesResponse);
      requestResponseMap.put(describeSpotInstanceRequest, describeSpotInstanceResponse);

      ComputeService createsVPCSpotInstance = requestsSendResponses(requestResponseMap.build());

      Template template = createsVPCSpotInstance.templateBuilder().locationId("us-east-1a").build();

      template.getOptions().as(AWSEC2TemplateOptions.class).spotPrice(1f).subnetId("subnet-xyz").keyPair("Demo").blockUntilRunning(false);

      NodeMetadata node = Iterables.getOnlyElement(createsVPCSpotInstance.createNodesInGroup("test", 1, template));
      assertEquals(node.getId(), "us-east-1/sir-228e6406");
View Full Code Here

      requestResponseMap.put(requestSpotInstancesRequest, requestSpotInstancesResponse);
      requestResponseMap.put(describeSpotInstanceRequest, describeSpotInstanceResponse);

      ComputeService createsSpotInstance = requestsSendResponses(requestResponseMap.build());

      Template template = createsSpotInstance.templateBuilder().locationId("us-east-1a").build();

      template.getOptions().as(AWSEC2TemplateOptions.class).spotPrice(1f).iamInstanceProfileArn(iamInstanceProfileArn)
            .noKeyPair().blockUntilRunning(false);

      NodeMetadata node = Iterables.getOnlyElement(createsSpotInstance.createNodesInGroup("test", 1, template));
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.