當前位置: 首頁>>代碼示例>>Java>>正文


Java AmazonEC2.describeAvailabilityZones方法代碼示例

本文整理匯總了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;
}
 
開發者ID:hudson3-plugins,項目名稱:ec2-plugin,代碼行數:19,代碼來源:EC2AbstractSlave.java

示例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);
}
 
開發者ID:Netflix,項目名稱:Raigad,代碼行數:20,代碼來源:RaigadConfiguration.java

示例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());
    }
}
 
開發者ID:awsdocs,項目名稱:aws-doc-sdk-examples,代碼行數:28,代碼來源:DescribeRegionsAndZones.java

示例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;
}
 
開發者ID:hudson3-plugins,項目名稱:ec2-plugin,代碼行數:13,代碼來源:SlaveTemplate.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-gobblin,代碼行數:16,代碼來源:AWSSdkClient.java


注:本文中的com.amazonaws.services.ec2.AmazonEC2.describeAvailabilityZones方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。