Package org.cloudsimplus.slametrics
Class SlaContract
java.lang.Object
org.cloudsimplus.slametrics.SlaContract
public class SlaContract extends Object
Represents a SLA Contract containing a list of metrics.
It follows the standard used by
Amazon Cloudwatch.
The constants inside the class define the names of SLA Metrics supported in the JSON SLA Contract format.
Instances of this class can be created from a JSON file
using the getInstanceInternal(InputStream)
or
getInstance(String)
methods.
This way, one doesn't need to create instances
of this class using its default constructor.
This one is just used by the JSON parsing library.
For more details, check Raysa Oliveira's Master Thesis (only in Portuguese).
- Author:
- raysaoliveira
-
Constructor Summary
Constructors Constructor Description SlaContract()
Creates aSlaContract
. -
Method Summary
Modifier and Type Method Description SlaMetric
getAvailabilityMetric()
SlaMetric
getCpuUtilizationMetric()
double
getExpectedMaxPriceForSingleVm()
Gets the expected maximum price a single VM can cost, considering theFault Tolerance Level
.SlaMetric
getFaultToleranceLevel()
static SlaContract
getInstance(String jsonFilePath)
Gets anSlaContract
from a JSON file inside the application's resource directory.double
getMaxPrice()
Gets the maximum price a customer expects to pay hourly for all his/her running VMs.List<SlaMetric>
getMetrics()
int
getMinFaultToleranceLevel()
SlaMetric
getPriceMetric()
SlaMetric
getTaskCompletionTimeMetric()
SlaMetric
getWaitTimeMetric()
void
setMetrics(List<SlaMetric> metrics)
String
toString()
-
Constructor Details
-
SlaContract
public SlaContract()Creates aSlaContract
. If you want to get a contract from a JSON file, you shouldn't call the constructor directly. Instead, use some methods of the class methods.This constructor is just provided to enable the
Gson
object to use reflection to instantiate a SlaContract.- See Also:
getInstance(String)
-
-
Method Details
-
getInstance
Gets anSlaContract
from a JSON file inside the application's resource directory.- Parameters:
jsonFilePath
- the relative path to the JSON file representing the SLA contract to read- Returns:
- a
SlaContract
read from the JSON file
-
getMetrics
- Returns:
- the metrics
-
setMetrics
- Parameters:
metrics
- the metrics to set
-
getAvailabilityMetric
-
getCpuUtilizationMetric
-
getPriceMetric
-
getWaitTimeMetric
-
getTaskCompletionTimeMetric
-
getFaultToleranceLevel
-
getMaxPrice
public double getMaxPrice()Gets the maximum price a customer expects to pay hourly for all his/her running VMs.- Returns:
-
getExpectedMaxPriceForSingleVm
public double getExpectedMaxPriceForSingleVm()Gets the expected maximum price a single VM can cost, considering theFault Tolerance Level
.- Returns:
- the expected maximum price a single VM can cost for the given customer
AwsEc2Template
for the customer's expected price
-
getMinFaultToleranceLevel
public int getMinFaultToleranceLevel() -
toString
-