Search in sources :

Example 46 with Ec2Client

use of software.amazon.awssdk.services.ec2.Ec2Client in project iep by Netflix.

the class AwsClientFactoryTest method newInstanceInterface.

@Test
public void newInstanceInterface() throws Exception {
    AwsClientFactory factory = new AwsClientFactory(config);
    EC2Client ec2 = factory.newInstance(EC2Client.class);
    Assert.assertNotNull(ec2);
}
Also used : EC2Client(software.amazon.awssdk.services.ec2.EC2Client) Test(org.junit.Test)

Example 47 with Ec2Client

use of software.amazon.awssdk.services.ec2.Ec2Client in project iep by Netflix.

the class AwsModuleTest method createClientUsingProvider.

@Test
public void createClientUsingProvider() {
    Module module = new AbstractModule() {

        @Override
        protected void configure() {
        }

        @Provides
        private EC2Client providesEC2(AwsClientFactory factory) {
            return factory.newInstance(EC2Client.class);
        }
    };
    Injector injector = Guice.createInjector(module, new AwsModule());
    EC2Client client = injector.getInstance(EC2Client.class);
    Assert.assertNotNull(client);
}
Also used : Injector(com.google.inject.Injector) Module(com.google.inject.Module) AbstractModule(com.google.inject.AbstractModule) AbstractModule(com.google.inject.AbstractModule) EC2Client(software.amazon.awssdk.services.ec2.EC2Client) Test(org.junit.Test)

Example 48 with Ec2Client

use of software.amazon.awssdk.services.ec2.Ec2Client in project iep by Netflix.

the class AwsModuleTest method createClient.

@Test
public void createClient() {
    Injector injector = Guice.createInjector(new AwsModule());
    AwsClientFactory factory = injector.getInstance(AwsClientFactory.class);
    EC2Client client = factory.newInstance(EC2Client.class);
    Assert.assertNotNull(client);
}
Also used : Injector(com.google.inject.Injector) EC2Client(software.amazon.awssdk.services.ec2.EC2Client) Test(org.junit.Test)

Aggregations

Ec2Client (software.amazon.awssdk.services.ec2.Ec2Client)21 Region (software.amazon.awssdk.regions.Region)20 Ec2Exception (software.amazon.awssdk.services.ec2.model.Ec2Exception)16 Test (org.junit.Test)5 EC2Client (software.amazon.awssdk.services.ec2.EC2Client)5 Injector (com.google.inject.Injector)2 DescribeInstancesRequest (software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest)2 DescribeInstancesResponse (software.amazon.awssdk.services.ec2.model.DescribeInstancesResponse)2 Instance (software.amazon.awssdk.services.ec2.model.Instance)2 Reservation (software.amazon.awssdk.services.ec2.model.Reservation)2 AbstractModule (com.google.inject.AbstractModule)1 Module (com.google.inject.Module)1 ListIterator (java.util.ListIterator)1 EC2Client (org.jclouds.aws.ec2.EC2Client)1 EC2AsyncClient (org.jclouds.ec2.EC2AsyncClient)1 EC2Client (org.jclouds.ec2.EC2Client)1 KeyPair (org.jclouds.ec2.domain.KeyPair)1 RunningInstance (org.jclouds.ec2.domain.RunningInstance)1 AccountAttribute (software.amazon.awssdk.services.ec2.model.AccountAttribute)1 AccountAttributeValue (software.amazon.awssdk.services.ec2.model.AccountAttributeValue)1