Tabnine Logo
RunningInstanceToNodeMetadata
Code IndexAdd Tabnine to your IDE (free)

How to use
RunningInstanceToNodeMetadata
in
org.jclouds.ec2.compute.functions

Best Java code snippets using org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata (Showing top 20 results out of 315)

origin: jclouds/legacy-jclouds

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}
origin: jclouds/legacy-jclouds

private Location getLocationForAvailabilityZoneOrRegion(final RunningInstance instance) {
 Location location = findLocationWithId(instance.getAvailabilityZone());
 if (location == null)
   location = findLocationWithId(instance.getRegion());
 return location;
}
origin: jclouds/legacy-jclouds

@VisibleForTesting
String getGroupForInstance(final RunningInstance instance) {
 String group = parseGroupFrom(instance, instance.getGroupNames());
 if(group == null && instance.getKeyName() != null) {
   // when not using a generated security group, e.g. in VPC, try from key:
   group = parseGroupFrom(instance, Sets.newHashSet(instance.getKeyName()));
 }
 return group;
}
origin: jclouds/legacy-jclouds

builder.providerId(instance.getId());
builder.id(instance.getRegion() + "/" + instance.getId());
String group = getGroupForInstance(instance);
builder.group(group);
addCredentialsForInstance(builder, instance);
builder.status(instanceToNodeStatus.get(instance.getInstanceState()));
builder.backendStatus(instance.getRawState());
builder.hardware(parseHardware(instance));
Location location = getLocationForAvailabilityZoneOrRegion(instance);
builder.location(location);
builder.imageId(instance.getRegion() + "/" + instance.getImageId());
origin: org.apache.jclouds.provider/aws-ec2

protected Hardware parseHardware(RunningInstance instance) {
 Hardware in = super.parseHardware(instance);
 if (in == null)
   return null;
 AWSRunningInstance awsInstance = AWSRunningInstance.class.cast(instance);
 return HardwareBuilder.fromHardware(in).hypervisor(awsInstance.getHypervisor().toString()).build();
}
origin: jclouds/legacy-jclouds

private void checkGroupName(RunningInstance instance) {
 assertEquals("groupname", createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
    .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of())
    .apply(instance).getGroup());
}
origin: jclouds/legacy-jclouds

private RunningInstanceToNodeMetadata createNodeParser(final ImmutableSet<Hardware> hardware,
    final ImmutableSet<Location> locations, Map<String, Credentials> credentialStore,
    Map<InstanceState, Status> instanceToNodeStatus, LoadingCache<RegionAndName, Image> instanceToImage) {
 Supplier<Set<? extends Location>> locationSupplier = new Supplier<Set<? extends Location>>() {
   @Override
   public Set<? extends Location> get() {
    return locations;
   }
 };
 Supplier<Set<? extends Hardware>> hardwareSupplier = new Supplier<Set<? extends Hardware>>() {
   @Override
   public Set<? extends Hardware> get() {
    return hardware;
   }
 };
 GroupNamingConvention.Factory namingConvention = Guice.createInjector(new AbstractModule() {
   @Override
   protected void configure() {
    Names.bindProperties(binder(),new EC2ApiMetadata().getDefaultProperties());
   }
 }).getInstance(GroupNamingConvention.Factory.class);
 RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(instanceToNodeStatus, credentialStore,
    Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance(instanceToImage), locationSupplier,
    hardwareSupplier, namingConvention);
 return parser;
}
origin: org.apache.jclouds.api/ec2

builder.providerId(instance.getId());
builder.id(instance.getRegion() + "/" + instance.getId());
String group = getGroupForInstance(instance);
builder.group(group);
addCredentialsForInstance(builder, instance);
builder.status(instanceToNodeStatus.get(instance.getInstanceState()));
builder.backendStatus(instance.getRawState());
builder.hardware(parseHardware(instance));
Location location = getLocationForAvailabilityZoneOrRegion(instance);
builder.location(location);
builder.imageId(instance.getRegion() + "/" + instance.getImageId());
origin: io.cloudsoft.jclouds.provider/aws-ec2

protected Hardware parseHardware(RunningInstance instance) {
 Hardware in = super.parseHardware(instance);
 if (in == null)
   return null;
 AWSRunningInstance awsInstance = AWSRunningInstance.class.cast(instance);
 return HardwareBuilder.fromHardware(in).hypervisor(awsInstance.getHypervisor().toString()).build();
}
origin: apache/jclouds

private void checkGroupName(RunningInstance instance) {
 assertEquals("groupname", createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
    .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of())
    .apply(instance).getGroup());
}
origin: apache/jclouds

private RunningInstanceToNodeMetadata createNodeParser(final ImmutableSet<Hardware> hardware,
    final ImmutableSet<Location> locations, Map<String, Credentials> credentialStore,
    Map<InstanceState, Status> instanceToNodeStatus, LoadingCache<RegionAndName, Image> instanceToImage) {
 Supplier<Set<? extends Location>> locationSupplier = new Supplier<Set<? extends Location>>() {
   @Override
   public Set<? extends Location> get() {
    return locations;
   }
 };
 Supplier<Set<? extends Hardware>> hardwareSupplier = new Supplier<Set<? extends Hardware>>() {
   @Override
   public Set<? extends Hardware> get() {
    return hardware;
   }
 };
 GroupNamingConvention.Factory namingConvention = Guice.createInjector(new AbstractModule() {
   @Override
   protected void configure() {
    Names.bindProperties(binder(), new EC2ApiMetadata().getDefaultProperties());
   }
 }).getInstance(GroupNamingConvention.Factory.class);
 RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(instanceToNodeStatus, credentialStore,
    Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance(instanceToImage), locationSupplier,
    hardwareSupplier, namingConvention);
 return parser;
}
origin: com.amysta.jclouds.api/ec2

builder.providerId(instance.getId());
builder.id(instance.getRegion() + "/" + instance.getId());
String group = getGroupForInstance(instance);
builder.group(group);
addCredentialsForInstance(builder, instance);
builder.status(instanceToNodeStatus.get(instance.getInstanceState()));
builder.backendStatus(instance.getRawState());
builder.hardware(parseHardware(instance));
Location location = getLocationForAvailabilityZoneOrRegion(instance);
builder.location(location);
builder.imageId(instance.getRegion() + "/" + instance.getImageId());
origin: com.amysta.jclouds.api/ec2

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}
origin: apache/jclouds

protected Hardware parseHardware(RunningInstance instance) {
 Hardware in = super.parseHardware(instance);
 if (in == null)
   return null;
 AWSRunningInstance awsInstance = AWSRunningInstance.class.cast(instance);
 return HardwareBuilder.fromHardware(in).hypervisor(awsInstance.getHypervisor().toString()).build();
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
      .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 assertEquals(parser.apply(server).toString(),
    new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
       .publicAddresses(ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.243.42.70"))
       .publicAddresses(ImmutableSet.of("174.129.81.68")).imageId("us-east-1/ami-82e4b5c7")
       .id("us-east-1/i-0799056f").providerId("i-0799056f").build().toString());
}
origin: com.amysta.jclouds.api/ec2

@VisibleForTesting
String getGroupForInstance(final RunningInstance instance) {
 String group = parseGroupFrom(instance, instance.getGroupNames());
 if (group == null && instance.getKeyName() != null) {
   // when not using a generated security group, e.g. in VPC, try from key:
   group = parseGroupFrom(instance, Sets.newHashSet(instance.getKeyName()));
 }
 return group;
}
origin: org.apache.jclouds.api/ec2

private Location getLocationForAvailabilityZoneOrRegion(final RunningInstance instance) {
 Location location = findLocationWithId(instance.getAvailabilityZone());
 if (location == null)
   location = findLocationWithId(instance.getRegion());
 return location;
}
origin: org.jclouds.api/ec2

builder.providerId(instance.getId());
builder.id(instance.getRegion() + "/" + instance.getId());
String group = getGroupForInstance(instance);
builder.group(group);
addCredentialsForInstance(builder, instance);
builder.status(instanceToNodeStatus.get(instance.getInstanceState()));
builder.backendStatus(instance.getRawState());
builder.hardware(parseHardware(instance));
Location location = getLocationForAvailabilityZoneOrRegion(instance);
builder.location(location);
builder.imageId(instance.getRegion() + "/" + instance.getImageId());
origin: org.apache.jclouds.api/ec2

protected Hardware parseHardware(final RunningInstance instance) {
 Hardware hardware = getHardwareForInstance(instance);
 if (hardware != null) {
   hardware = HardwareBuilder.fromHardware(hardware).volumes(addEBS(instance, hardware.getVolumes())).build();
 }
 return hardware;
}
origin: jclouds/legacy-jclouds

@Test
public void testApplyWhereTagDoesntMatchAndLocationFoundAndImageAndHardwareNotFound() throws UnknownHostException {
 RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
      ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
 RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
 NodeMetadata expected = new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
      .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
      .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
      .location(provider).build();
 assertEquals(parser.apply(server).toString(), expected.toString());
}
org.jclouds.ec2.compute.functionsRunningInstanceToNodeMetadata

Most used methods

  • parseHardware
  • addCredentialsForInstance
  • addEBS
  • findLocationWithId
  • getGroupForInstance
  • getHardwareForInstance
  • getLocationForAvailabilityZoneOrRegion
  • parseGroupFrom
  • <init>
  • apply

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • String (java.lang)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now