本文整理匯總了Java中com.amazonaws.services.ec2.AmazonEC2.describeAvailabilityZones方法的典型用法代碼示例。如果您正苦於以下問題:Java AmazonEC2.describeAvailabilityZones方法的具體用法?Java AmazonEC2.describeAvailabilityZones怎麽用?Java AmazonEC2.describeAvailabilityZones使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.ec2.AmazonEC2
的用法示例。
在下文中一共展示了AmazonEC2.describeAvailabilityZones方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fillZoneItems
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
public static ListBoxModel fillZoneItems(AWSCredentialsProvider credentialsProvider, String region) {
ListBoxModel model = new ListBoxModel();
if (AmazonEC2Cloud.testMode) {
model.add(TEST_ZONE);
return model;
}
if (!StringUtils.isEmpty(region)) {
AmazonEC2 client = EC2Cloud.connect(credentialsProvider, AmazonEC2Cloud.getEc2EndpointUrl(region));
DescribeAvailabilityZonesResult zones = client.describeAvailabilityZones();
List<AvailabilityZone> zoneList = zones.getAvailabilityZones();
model.add("<not specified>", "");
for (AvailabilityZone z : zoneList) {
model.add(z.getZoneName(), z.getZoneName());
}
}
return model;
}
示例2: setDefaultRACList
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
/**
* Get the fist 3 available zones in the region
*/
public void setDefaultRACList(String region) {
AmazonEC2 client = new AmazonEC2Client(provider.getAwsCredentialProvider());
client.setEndpoint("ec2." + region + ".amazonaws.com");
DescribeAvailabilityZonesResult res = client.describeAvailabilityZones();
List<String> zone = Lists.newArrayList();
for (AvailabilityZone reg : res.getAvailabilityZones()) {
if (reg.getState().equals("available")) {
zone.add(reg.getZoneName());
}
if (zone.size() == 3) {
break;
}
}
DEFAULT_AVAILABILITY_ZONES = ImmutableList.copyOf(zone);
}
示例3: main
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
public static void main(String[] args)
{
final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
DescribeRegionsResult regions_response = ec2.describeRegions();
for(Region region : regions_response.getRegions()) {
System.out.printf(
"Found region %s " +
"with endpoint %s",
region.getRegionName(),
region.getEndpoint());
}
DescribeAvailabilityZonesResult zones_response =
ec2.describeAvailabilityZones();
for(AvailabilityZone zone : zones_response.getAvailabilityZones()) {
System.out.printf(
"Found availability zone %s " +
"with status %s " +
"in region %s",
zone.getZoneName(),
zone.getState(),
zone.getRegionName());
}
}
示例4: getAvailabilityZones
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
private ArrayList<String> getAvailabilityZones(AmazonEC2 ec2) {
ArrayList<String> availabilityZones = new ArrayList<String>();
DescribeAvailabilityZonesResult zones = ec2.describeAvailabilityZones();
List<AvailabilityZone> zoneList = zones.getAvailabilityZones();
for (AvailabilityZone z : zoneList) {
availabilityZones.add(z.getZoneName());
}
return availabilityZones;
}
示例5: getAvailabilityZones
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
/***
* Get availability zones in an Amazon AWS region
*
* @return List of availability zones
*/
public List<AvailabilityZone> getAvailabilityZones() {
final AmazonEC2 amazonEC2 = getEc2Client();
final DescribeAvailabilityZonesResult describeAvailabilityZonesResult = amazonEC2.describeAvailabilityZones();
final List<AvailabilityZone> availabilityZones = describeAvailabilityZonesResult.getAvailabilityZones();
LOGGER.info("Found: " + availabilityZones.size() + " availability zone");
return availabilityZones;
}