use of com.google.api.services.notebooks.v1.model.Instance in project SimianArmy by Netflix.
the class AWSClient method getVpcId.
/**
* Gets the VPC id for the given instance.
*
* @param instanceId
* instance we're checking
* @return vpc id, or null if not a vpc instance
*/
String getVpcId(String instanceId) {
Instance awsInstance = describeInstance(instanceId);
String vpcId = awsInstance.getVpcId();
if (Strings.isNullOrEmpty(vpcId)) {
return null;
}
return vpcId;
}
use of com.google.api.services.notebooks.v1.model.Instance in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method testInstancesWithNullIds.
@Test
public void testInstancesWithNullIds() {
List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
List<Instance> instanceList = createInstanceList();
AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
List<Resource> resources = crawler.resources();
verifyInstanceList(resources, instanceDetailsList);
}
use of com.google.api.services.notebooks.v1.model.Instance in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method testInstancesWithResourceType.
@Test
public void testInstancesWithResourceType() {
List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
List<Instance> instanceList = createInstanceList();
AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
for (AWSResourceType resourceType : AWSResourceType.values()) {
List<Resource> resources = crawler.resources(resourceType);
if (resourceType == AWSResourceType.INSTANCE) {
verifyInstanceList(resources, instanceDetailsList);
} else {
Assert.assertTrue(resources.isEmpty());
}
}
}
use of com.google.api.services.notebooks.v1.model.Instance in project airavata by apache.
the class AmazonUtil method launchInstance.
/**
* Launch a new EC2 instance
*
* @param AMI_ID
* @param type
* @param number
* @param keyname
* @return list of newly launched instances
*/
public static List<Instance> launchInstance(String AMI_ID, String type, Integer number, String keyname) {
List<Instance> resultList = new ArrayList<Instance>();
RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
request.setInstanceType(type);
request.setKeyName(keyname);
RunInstancesResult result = getEC2Client().runInstances(request);
resultList.addAll(result.getReservation().getInstances());
return resultList;
}
use of com.google.api.services.notebooks.v1.model.Instance in project airavata by apache.
the class AmazonUtil method launchInstance.
/**
* Launch a new EC2 instance
*
* @param AMI_ID
* @param type
* @param number
* @return list of newly launched instances
*/
public static List<Instance> launchInstance(String AMI_ID, String type, Integer number) {
List<Instance> resultList = new ArrayList<Instance>();
RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
request.setInstanceType(type);
RunInstancesResult result = getEC2Client().runInstances(request);
resultList.addAll(result.getReservation().getInstances());
return resultList;
}
Aggregations