当前位置: 首页>>代码示例>>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;未经允许,请勿转载。