com.atlassian.aws.ec2
Class EC2Utils

java.lang.Object
  extended by com.atlassian.aws.ec2.EC2Utils

public class EC2Utils
extends Object


Method Summary
static void disableCompresssion()
          Deprecated. 
static EC2Image getCurrentImage()
           
static String getEbsDeviceName(com.amazonaws.services.ec2.model.Image image)
           
static EC2Instance getLocalEC2Instance()
           
static List<com.amazonaws.services.ec2.model.IpPermission> getMatchingIpPermissions(com.amazonaws.services.ec2.model.SecurityGroup group, Protocol protocol, String cidrIpRange, int port)
           
static
<T> T
getUserData(Class<T> aClass)
          Retrieves a serialised object from the EC2 user data for the current host.
static boolean isWindows(com.amazonaws.services.ec2.model.Image image)
           
static void setUserData(com.amazonaws.services.ec2.model.LaunchSpecification launchSpecification, Object userData)
          AWS SDK variant for spot instances: Populates the user data of an EC2 with an object.
static void setUserData(com.amazonaws.services.ec2.model.RunInstancesRequest runInstancesRequest, Object userData)
          AWS SDK variant for regular instances: Populates the user data of an EC2 with an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLocalEC2Instance

@NotNull
public static EC2Instance getLocalEC2Instance()
                                       throws IOException
Returns:
The EC2Instance upon which the current JVM is hosted.
Throws:
IOException - if necessary data could not be read.

setUserData

public static void setUserData(@NotNull
                               com.amazonaws.services.ec2.model.LaunchSpecification launchSpecification,
                               @Nullable
                               Object userData)
                        throws IOException
AWS SDK variant for spot instances: Populates the user data of an EC2 with an object.

Parameters:
launchSpecification - The launchSpecification to populate
userData - The object to serialise
Throws:
IOException - If the object could not be serialised.

setUserData

public static void setUserData(@NotNull
                               com.amazonaws.services.ec2.model.RunInstancesRequest runInstancesRequest,
                               @Nullable
                               Object userData)
AWS SDK variant for regular instances: Populates the user data of an EC2 with an object.

Parameters:
runInstancesRequest - The launchSpecification to populate
userData - The object to serialise
Throws:
IOException - If the object could not be serialised.

getUserData

public static <T> T getUserData(Class<T> aClass)
                     throws IOException,
                            ClassNotFoundException

Retrieves a serialised object from the EC2 user data for the current host.

Returns:
The retrieved object.
Throws:
IOException - If the user data could not be read or deserialised.
ClassNotFoundException - If a required Class could not be found.

getCurrentImage

public static EC2Image getCurrentImage()
                                throws IOException
Returns:
The EC2Image upon which the current process is running.
Throws:
IOException - If the EC2Image cannot be identified, possibly because the current process is not running in EC2.

disableCompresssion

@Deprecated
public static void disableCompresssion()
Deprecated. 


isWindows

public static boolean isWindows(@NotNull
                                com.amazonaws.services.ec2.model.Image image)

getMatchingIpPermissions

@NotNull
public static List<com.amazonaws.services.ec2.model.IpPermission> getMatchingIpPermissions(@NotNull
                                                                                                   com.amazonaws.services.ec2.model.SecurityGroup group,
                                                                                                   @NotNull
                                                                                                   Protocol protocol,
                                                                                                   @Nullable
                                                                                                   String cidrIpRange,
                                                                                                   int port)

getEbsDeviceName

public static String getEbsDeviceName(@NotNull
                                      com.amazonaws.services.ec2.model.Image image)


Copyright © 2015 Atlassian. All rights reserved.