Example usage for com.amazonaws.services.ec2 AmazonEC2Client builder

List of usage examples for com.amazonaws.services.ec2 AmazonEC2Client builder

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2 AmazonEC2Client builder.

Prototype

public static AmazonEC2ClientBuilder builder() 

Source Link

Usage

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

License:Apache License

public static AmazonEC2 newEc2Client(AwsConfiguration config, AWSCredentialsProvider provider, String vip,
        String region) {//from   w  w w. j a v a  2  s  .  c  om
    if (config.useMock())
        throw new UnsupportedOperationException("EC2 mock not yet supported");

    EddaEc2Client edda = new EddaEc2Client(config, vip, region);
    if (config.useEdda() && !config.wrapAwsClient())
        return edda.readOnly();

    AmazonEC2 client = AmazonEC2Client.builder().withCredentials(provider)
            .withClientConfiguration(clientConfig(config)).withRegion(region).build();
    if (config.useEdda())
        client = edda.wrapAwsClient(client);
    return client;
}