Example usage for com.amazonaws.services.ec2.model Subnet getState

List of usage examples for com.amazonaws.services.ec2.model Subnet getState

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model Subnet getState.

Prototype


public String getState() 

Source Link

Document

The current state of the subnet.

Usage

From source file:com.infinitechaos.vpcviewer.web.rest.dto.SubnetDTO.java

License:Open Source License

public SubnetDTO(final Subnet subnet) {
    this.subnetId = subnet.getSubnetId();
    this.vpcId = subnet.getVpcId();
    this.state = subnet.getState();
    this.availabilityZone = subnet.getAvailabilityZone();
    this.cidrBlock = subnet.getCidrBlock();

    this.tags.addAll(subnet.getTags().stream().map(TagDTO::new).collect(Collectors.toList()));

    this.name = subnet.getTags().stream().filter(t -> t.getKey().equals("Name")).findFirst().map(Tag::getValue)
            .orElse("n/a");
}

From source file:org.wildfly.camel.test.common.aws.EC2Utils.java

License:Apache License

public static String getSubnetId(AmazonEC2Client ec2Client) {
    Subnet subnet = null;//from w w w . j a  v a2  s  .c  om
    for (Subnet aux : ec2Client.describeSubnets().getSubnets()) {
        System.out.println();
        if (aux.getState().equals("available") && aux.getAvailabilityZone().startsWith("eu-west-1")) {
            subnet = aux;
            break;
        }
    }
    Assert.assertNotNull("Subnet not null", subnet);
    return subnet.getSubnetId();
}