Package org.cloudsimplus.vmtemplates
Class AwsEc2Template
java.lang.Object
org.cloudsimplus.vmtemplates.AwsEc2Template
- All Implemented Interfaces:
Comparable<AwsEc2Template>
public class AwsEc2Template extends Object implements Comparable<AwsEc2Template>
Represents an
Amazon EC2 VM Instance template.
This class enables reading a template from a JSON file, containing actual configurations for VMs
available in Amazon Web Services.
For more details, check Raysa Oliveira's Master Thesis (only in Portuguese).
- Author:
- raysaoliveira
- See Also:
getInstance(String)
-
Field Summary
Fields Modifier and Type Field Description static AwsEc2Template
NULL
-
Constructor Summary
Constructors Constructor Description AwsEc2Template()
Default constructor used to create anAwsEc2Template
instance.AwsEc2Template(String jsonFilePath)
Instantiates an AWS EC2 Instance from a JSON file.AwsEc2Template(AwsEc2Template source)
A clone constructor which receives anAwsEc2Template
and creates a clone of it. -
Method Summary
Modifier and Type Method Description int
compareTo(AwsEc2Template template)
int
getCpus()
String
getFileName()
Gets only the name of the JSON template file used to create this template, without the path.String
getFilePath()
Gets the full path to the JSON template file used to create this template.static AwsEc2Template
getInstance(String jsonFilePath)
Gets an AWS EC2 Instance from a JSON file inside the application's resource directory.int
getMemoryInMB()
String
getName()
double
getPricePerHour()
Gets the price per hour of a VM created from this templateString
getRegion()
Gets the AWS Region in which the instance is run.void
setCpus(int cpus)
void
setMemoryInMB(int memoryInMB)
void
setName(String name)
void
setPricePerHour(double pricePerHour)
void
setRegion(String region)
String
toString()
-
Field Details
-
NULL
-
-
Constructor Details
-
AwsEc2Template
public AwsEc2Template()Default constructor used to create anAwsEc2Template
instance. If you want to get a template from a JSON file, you shouldn't call the constructor directly. Instead, use some methods such as thegetInstance(String)
.This constructor is just provided to enable the
Gson
object to use reflection to instantiate a AwsEc2Template.- See Also:
getInstance(String)
-
AwsEc2Template
A clone constructor which receives anAwsEc2Template
and creates a clone of it.- Parameters:
source
- theAwsEc2Template
to be cloned
-
AwsEc2Template
Instantiates an AWS EC2 Instance from a JSON file.- Parameters:
jsonFilePath
- the full path to the JSON file representing the template with configurations for an AWS EC2 Instance- See Also:
getInstance(String)
-
-
Method Details
-
getInstance
Gets an AWS EC2 Instance from a JSON file inside the application's resource directory. Use the available constructors if you want to load a file outside the resource directory.- Parameters:
jsonFilePath
- the relative path to the JSON file representing the template with configurations for an AWS EC2 Instance- Returns:
- the AWS EC2 Instance from the JSON file
-
getName
-
setName
-
getCpus
public int getCpus() -
setCpus
public void setCpus(int cpus) -
getMemoryInMB
public int getMemoryInMB() -
setMemoryInMB
public void setMemoryInMB(int memoryInMB) -
getPricePerHour
public double getPricePerHour()Gets the price per hour of a VM created from this template- Returns:
-
setPricePerHour
public void setPricePerHour(double pricePerHour) -
getRegion
Gets the AWS Region in which the instance is run.- Returns:
- See Also:
- AWS Regions, Availability Zones, and Local Zones
-
setRegion
-
getFilePath
Gets the full path to the JSON template file used to create this template.- Returns:
-
getFileName
Gets only the name of the JSON template file used to create this template, without the path.- Returns:
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AwsEc2Template>
-