Package org.jclouds.aws.ec2.domain

Examples of org.jclouds.aws.ec2.domain.LaunchSpecification$Builder


      return extra;
   }

   @VisibleForTesting
   String getPrivateKeyOrNull(RunningInstance instance, String tag) {
      KeyPair keyPair = credentialsMap.get(new RegionAndName(instance.getRegion(), instance
               .getKeyName()));
      return keyPair != null ? keyPair.getKeyMaterial() : null;
   }
View Full Code Here


   protected Set<RunningInstance> createNodesInRegionAndZone(String region, String zone, String group,
            int count, Template template, RunInstancesOptions instanceOptions) {
      Float spotPrice = getSpotPriceOrNull(template.getOptions());
      if (spotPrice != null) {
         AWSEC2TemplateOptions awsOptions = AWSEC2TemplateOptions.class.cast(template.getOptions());
         LaunchSpecification spec = AWSRunInstancesOptions.class.cast(instanceOptions).getLaunchSpecificationBuilder()
               .imageId(template.getImage().getProviderId()).availabilityZone(zone).subnetId(awsOptions.getSubnetId())
               .iamInstanceProfileArn(awsOptions.getIAMInstanceProfileArn())
               .iamInstanceProfileName(awsOptions.getIAMInstanceProfileName()).build();
         RequestSpotInstancesOptions options = awsOptions.getSpotOptions();
         if (logger.isDebugEnabled())
View Full Code Here

   protected Set<RunningInstance> createNodesInRegionAndZone(String region, String zone, String group,
            int count, Template template, RunInstancesOptions instanceOptions) {
      Float spotPrice = getSpotPriceOrNull(template.getOptions());
      if (spotPrice != null) {
         AWSEC2TemplateOptions awsOptions = AWSEC2TemplateOptions.class.cast(template.getOptions());
         LaunchSpecification spec = AWSRunInstancesOptions.class.cast(instanceOptions).getLaunchSpecificationBuilder()
               .imageId(template.getImage().getProviderId()).availabilityZone(zone).subnetId(awsOptions.getSubnetId())
                 .publicIpAddressAssociated(awsOptions.isPublicIpAddressAssociated())
               .iamInstanceProfileArn(awsOptions.getIAMInstanceProfileArn())
               .iamInstanceProfileName(awsOptions.getIAMInstanceProfileName()).build();
         RequestSpotInstancesOptions options = awsOptions.getSpotOptions();
View Full Code Here

   @SuppressWarnings("unchecked")
   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof LaunchSpecification, "this binder is only valid for LaunchSpecifications!");
      LaunchSpecification launchSpec = LaunchSpecification.class.cast(input);
      return (R) request.toBuilder().replaceFormParams(Multimaps.forMap(apply(launchSpec))).build();
   }
View Full Code Here

public class BindLaunchSpecificationToFormParamsTest {
   BindLaunchSpecificationToFormParams binder = new BindLaunchSpecificationToFormParams();

   @Test
   public void testApplyWithBlockDeviceMappings() throws UnknownHostException {
      LaunchSpecification spec = LaunchSpecification.builder().instanceType(InstanceType.T1_MICRO).imageId("ami-123")
            .mapNewVolumeToDevice("/dev/sda1", 120, true).build();

      assertEquals(binder.apply(spec), ImmutableMap.of("LaunchSpecification.InstanceType", "t1.micro",
            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.BlockDeviceMapping.1.DeviceName",
            "/dev/sda1", "LaunchSpecification.BlockDeviceMapping.1.Ebs.VolumeSize", "120",
View Full Code Here

            "LaunchSpecification.BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true"));
   }

   @Test
   public void testApplyWithUserData() throws UnknownHostException {
      LaunchSpecification spec = LaunchSpecification.builder().instanceType(InstanceType.T1_MICRO).imageId("ami-123")
            .userData("hello".getBytes()).build();

      assertEquals(binder.apply(spec), ImmutableMap.of("LaunchSpecification.InstanceType", "t1.micro",
            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.UserData",
            base64().encode("hello".getBytes(UTF_8))));
View Full Code Here

            base64().encode("hello".getBytes(UTF_8))));
   }

   @Test
   public void testApplyWithSecurityId() throws UnknownHostException {
      LaunchSpecification spec = LaunchSpecification.builder().instanceType(InstanceType.T1_MICRO).imageId("ami-123")
            .securityGroupId("sid-foo").build();

      assertEquals(binder.apply(spec), ImmutableMap.of("LaunchSpecification.InstanceType", "t1.micro",
            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.SecurityGroupId.1", "sid-foo"));
   }
View Full Code Here

            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.SecurityGroupId.1", "sid-foo"));
   }

   @Test
   public void testApplyWithSubnetId() throws UnknownHostException {
      LaunchSpecification spec = LaunchSpecification.builder().instanceType(InstanceType.T1_MICRO).imageId("ami-123")
            .subnetId("subnet-xyz").build();

      assertEquals(binder.apply(spec), ImmutableMap.of("LaunchSpecification.InstanceType", "t1.micro",
            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.SubnetId", "subnet-xyz"));
   }
View Full Code Here

            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.SubnetId", "subnet-xyz"));
   }

   @Test
   public void testApplyWithIAMInstanceProfileArn() {
      LaunchSpecification spec = LaunchSpecification.builder()
            .instanceType(InstanceType.T1_MICRO)
            .imageId("ami-123")
            .iamInstanceProfileArn("arn:aws:iam::123456789012:instance-profile/application_abc/component_xyz/Webserver")
            .build();
View Full Code Here

            "arn:aws:iam::123456789012:instance-profile/application_abc/component_xyz/Webserver"));
   }

   @Test
   public void testApplyWithIAMInstanceProfileName() {
      LaunchSpecification spec = LaunchSpecification.builder().instanceType(InstanceType.T1_MICRO).imageId("ami-123")
            .iamInstanceProfileName("Webserver").build();

      assertEquals(binder.apply(spec), ImmutableMap.of("LaunchSpecification.InstanceType", "t1.micro",
            "LaunchSpecification.ImageId", "ami-123", "LaunchSpecification.IamInstanceProfile.Name", "Webserver"));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.aws.ec2.domain.LaunchSpecification$Builder

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.