use of com.amazonaws.services.ec2.model.AvailabilityZone in project GNS by MobilityFirst.
the class AWSEC2 method describeAvailabilityZones.
/**
* Describe Availability Zones
*
* @param ec2
*/
public static void describeAvailabilityZones(AmazonEC2 ec2) {
StringBuilder output = new StringBuilder();
String prefix = currentTab + "Availability Zones: ";
DescribeAvailabilityZonesResult availabilityZonesResult = ec2.describeAvailabilityZones();
prefix = prefix.concat(" [" + availabilityZonesResult.getAvailabilityZones().size() + " total] ");
for (AvailabilityZone zone : availabilityZonesResult.getAvailabilityZones()) {
output.append(prefix);
prefix = ", ";
output.append(zone.getZoneName());
}
System.out.println(output);
}
use of com.amazonaws.services.ec2.model.AvailabilityZone in project herd by FINRAOS.
the class MockSpotPrice method toAwsObject.
/**
* Converts this object into an AWS equivalent object.
*
* @return A new equivalent AWS object
*/
public SpotPrice toAwsObject() {
SpotPrice spotPrice = new SpotPrice();
spotPrice.setAvailabilityZone(availabilityZone);
spotPrice.setInstanceType(type);
spotPrice.setSpotPrice(this.spotPrice);
return spotPrice;
}
use of com.amazonaws.services.ec2.model.AvailabilityZone in project herd by FINRAOS.
the class MockAvailabilityZone method toAwsObject.
/**
* Converts this object into an AWS equivalent object.
*
* @return A new equivalent AWS object
*/
public AvailabilityZone toAwsObject() {
AvailabilityZone availabilityZone = new AvailabilityZone();
availabilityZone.setRegionName(regionName);
availabilityZone.setZoneName(zoneName);
return availabilityZone;
}
use of com.amazonaws.services.ec2.model.AvailabilityZone in project herd by FINRAOS.
the class MockSubnet method toAwsObject.
/**
* Converts this object into an AWS equivalent object.
*
* @return A new equivalent AWS object
*/
public Subnet toAwsObject() {
Subnet subnet = new Subnet();
subnet.setSubnetId(subnetId);
subnet.setAvailabilityZone(availabilityZone);
subnet.setAvailableIpAddressCount(availableIpAddressCount);
return subnet;
}
use of com.amazonaws.services.ec2.model.AvailabilityZone in project herd by FINRAOS.
the class EmrPricingHelper method getInstanceTypeSpotPrices.
/**
* Returns a mapping of instance types to spot prices for the given AZ and instance types. The spot prices are retrieved from EC2 API.
* <p/>
* This method also validates that the given instance types are real instance types supported by AWS.
*
* @param availabilityZone the AZ of the spot instances
* @param instanceTypes the size of the spot instances
* @param awsParamsDto the AWS related parameters for access/secret keys and proxy details
*
* @return the mapping of instance type to spot prices
* @throws ObjectNotFoundException when any of the instance type does not exist in AWS
*/
private Map<String, BigDecimal> getInstanceTypeSpotPrices(AvailabilityZone availabilityZone, Set<String> instanceTypes, AwsParamsDto awsParamsDto) {
List<String> productDescriptions = herdStringHelper.getDelimitedConfigurationValue(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS);
List<SpotPrice> spotPrices = ec2Dao.getLatestSpotPrices(availabilityZone.getZoneName(), instanceTypes, productDescriptions, awsParamsDto);
Map<String, BigDecimal> instanceTypeSpotPrices = new HashMap<>();
for (SpotPrice spotPrice : spotPrices) {
instanceTypeSpotPrices.put(spotPrice.getInstanceType(), new BigDecimal(spotPrice.getSpotPrice()));
}
return instanceTypeSpotPrices;
}
Aggregations