Example usage for com.amazonaws.services.ec2.model VpcPeeringConnection getVpcPeeringConnectionId

List of usage examples for com.amazonaws.services.ec2.model VpcPeeringConnection getVpcPeeringConnectionId

Introduction

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

Prototype


public String getVpcPeeringConnectionId() 

Source Link

Document

The ID of the VPC peering connection.

Usage

From source file:com.netflix.edda.EddaEc2Client.java

License:Apache License

public DescribeVpcPeeringConnectionsResult describeVpcPeeringConnections(
        DescribeVpcPeeringConnectionsRequest request) {
    validateEmpty("Filter", request.getFilters());

    TypeReference<List<VpcPeeringConnection>> ref = new TypeReference<List<VpcPeeringConnection>>() {
    };/*  w  ww  .  j  a  v  a  2 s  .  c  om*/
    String url = config.url() + "/api/v2/aws/vpcPeeringConnections;_expand";
    try {
        List<VpcPeeringConnection> vpcs = parse(ref, doGet(url));

        List<String> ids = request.getVpcPeeringConnectionIds();
        if (shouldFilter(ids)) {
            List<VpcPeeringConnection> vs = new ArrayList<VpcPeeringConnection>();
            for (VpcPeeringConnection v : vpcs) {
                if (matches(ids, v.getVpcPeeringConnectionId()))
                    vs.add(v);
            }
            vpcs = vs;
        }

        return new DescribeVpcPeeringConnectionsResult().withVpcPeeringConnections(vpcs);
    } catch (IOException e) {
        throw new AmazonClientException("Faled to parse " + url, e);
    }
}