@Override protected void cleanupResource(Resource resource) { securityGroupApi().deleteSecurityGroupInRegionById(null, resource.id); }
protected void cleanupKeyPair(String keyName) { try { client.deleteKeyPairInRegion(null, keyName); } catch (Exception e) { } client.deleteKeyPairInRegion(null, keyName); }
public void deleteInternetGateway() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/delete_internet_gateway.xml"); final boolean deleted = gatewayApi().deleteInternetGateway(DEFAULT_REGION, "igw-fada7c9c"); assertTrue(deleted, "Failed to delete gateway"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeleteInternetGateway&InternetGatewayId=igw-fada7c9c"); }
public void deletePlacementGroupInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse()); placementApi().deletePlacementGroupInRegion(DEFAULT_REGION, "name"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeletePlacementGroup&GroupName=name"); }
public void createPlacementGroupInRegion_strategy() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse()); placementApi().createPlacementGroupInRegion(DEFAULT_REGION, "name", "cluster"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=CreatePlacementGroup&GroupName=name&Strategy=cluster"); }
public void cancelSpotInstanceRequestsInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse()); spotApi().cancelSpotInstanceRequestsInRegion(DEFAULT_REGION, "sir-f4d44212"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=CancelSpotInstanceRequests&SpotInstanceRequestId.1=sir-f4d44212"); }
public void deleteSecurityGroups() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse().setBody(deleteSecurityGroupResponse)); securityGroupApi().deleteSecurityGroupInRegionById(DEFAULT_REGION, "sg-1a2b3c4d"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeleteSecurityGroup&GroupId=sg-1a2b3c4d"); }
public void associateRouteTable() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/associate_route_table.xml"); final String associationId = routeTableApi().associateRouteTable(DEFAULT_REGION, "rtb-8c95c0eb", "subnet-6986410e"); assertEquals(associationId, "rtbassoc-fb7fed9d", "Failed to associate route"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=AssociateRouteTable&RouteTableId=rtb-8c95c0eb&SubnetId=subnet-6986410e"); }
public void disassociateRouteTable() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/disassociate_route_table.xml"); final boolean result = routeTableApi().disassociateRouteTable(DEFAULT_REGION, "rtbassoc-fb7fed9d"); assertTrue(result, "Failed to disassociate route"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DisassociateRouteTable&AssociationId=rtbassoc-fb7fed9d"); }
public void attachInternetGateway() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/attach_internet_gateway.xml"); final Boolean attached = gatewayApi().attachInternetGateway(DEFAULT_REGION, "igw-fada7c9c", "vpc-6250b91b"); assertTrue(attached, "Failed to attach InternetGateway"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=AttachInternetGateway&InternetGatewayId=igw-fada7c9c&VpcId=vpc-6250b91b"); }
public void getLaunchPermissionForImageInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/describe_image_attribute_launchPermission.xml"); Permission result = amiApi().getLaunchPermissionForImageInRegion(DEFAULT_REGION, "ami-246f8d4d"); assertNotNull(result); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=ami-246f8d4d"); }
public void deleteRouteTable() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/delete_route_table.xml"); final boolean deleted = routeTableApi().deleteRouteTable(DEFAULT_REGION, "rtb-8bda6cef"); assertTrue(deleted, "Failed to match 'true' data in test response"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeleteRouteTable&RouteTableId=rtb-8bda6cef"); }
public void detachInternetGateway() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/detach_internet_gateway.xml"); final Boolean detached = gatewayApi().detachInternetGateway(DEFAULT_REGION, "igw-fada7c9c", "vpc-6250b91b"); assertTrue(detached, "Gateway not successfully detached"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DetachInternetGateway&InternetGatewayId=igw-fada7c9c&VpcId=vpc-6250b91b"); }
public void deregisterImageInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse()); amiApi().deregisterImageInRegion(DEFAULT_REGION, "ami-246f8d4d"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeregisterImage&ImageId=ami-246f8d4d"); }
public void deleteSubnetInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse().setBody("<DeleteSubnetResponse xmlns=\"http://ec2.amazonaws.com/doc/2016-09-15/\">\n" + " <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>\n" + " <return>true</return>\n" + "</DeleteSubnetResponse>")); subnetApi().deleteSubnetInRegion(DEFAULT_REGION, "subnet-9d4a7b6c"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeleteSubnet&SubnetId=subnet-9d4a7b6c"); }
public void deletePlacementGroupInRegion_404() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); placementApi().deletePlacementGroupInRegion(DEFAULT_REGION, "name"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DeletePlacementGroup&GroupName=name"); }
public void createPlacementGroupInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse()); placementApi().createPlacementGroupInRegion(DEFAULT_REGION, "name"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=CreatePlacementGroup&Strategy=cluster&GroupName=name"); }
public void associateRouteTableWithOptions() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(PRECONDITION_FAILED, DEFAULT_REGION, "/dry_run.xml"); try { routeTableApi().associateRouteTable(DEFAULT_REGION, "rtb-8c95c0eb", "subnet-6986410e", dryRun()); } catch (AWSResponseException e) { assertDryRun(e); } assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=AssociateRouteTable&RouteTableId=rtb-8c95c0eb&SubnetId=subnet-6986410e&DryRun=true"); }
public void disassociateRouteTablewithOptions() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(PRECONDITION_FAILED, DEFAULT_REGION, "/dry_run.xml"); try { routeTableApi().disassociateRouteTable(DEFAULT_REGION, "rtbassoc-fb7fed9d", dryRun()); } catch (AWSResponseException e) { assertDryRun(e); } assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DisassociateRouteTable&AssociationId=rtbassoc-fb7fed9d&DryRun=true"); }
public void attachInternetGatewayFail() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/attach_internet_gateway_failed.xml"); final Boolean attached = gatewayApi().attachInternetGateway(DEFAULT_REGION, "igw-fada7c9c", "vpc-6250b91b"); assertFalse(attached, "Gateway reported as created despite failure response"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=AttachInternetGateway&InternetGatewayId=igw-fada7c9c&VpcId=vpc-6250b91b"); }