@Test public void testTerminateWhenResourcesNull() { underTest.terminate(authenticatedContext(), cloudStack, null); verify(awsResourceConnector, times(1)).check(any(), any()); verify(awsComputeResourceService, times(1)).deleteComputeResources(any(), any(), any()); verify(encryptedImageCopyService, times(1)).deleteResources(any(), any(), any()); verify(cloudFormationRetryClient, never()).deleteStack(any()); verify(amazonAutoScalingRetryClient, never()).describeAutoScalingGroups(any()); }
public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { LOGGER.debug("Deleting stack: {}", ac.getCloudContext().getId()); AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); AuthenticatedContextView authenticatedContextView = new AuthenticatedContextView(ac); String regionName = authenticatedContextView.getRegion(); AmazonEC2Client amazonEC2Client = authenticatedContextView.getAmazonEC2Client(); AmazonCloudFormationClient amazonCloudFormationClient = awsClient.createCloudFormationClient(credentialView, regionName); awsCloudWatchService.deleteCloudWatchAlarmsForSystemFailures(stack, regionName, credentialView); waitAndDeleteCloudformationStack(ac, stack, resources, amazonCloudFormationClient); awsComputeResourceService.deleteComputeResources(ac, stack, resources); cleanupEncryptedResources(ac, resources, regionName, amazonEC2Client); deleteKeyPair(ac, stack, amazonEC2Client, credentialView, regionName); deleteLaunchConfiguration(resources, ac); LOGGER.debug("Deleting stack finished"); return awsResourceConnector.check(ac, resources); }
AwsTerminateService { public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { LOGGER.debug("Deleting stack: {}", ac.getCloudContext().getId()); AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); AuthenticatedContextView authenticatedContextView = new AuthenticatedContextView(ac); String regionName = authenticatedContextView.getRegion(); AmazonEC2Client amazonEC2Client = authenticatedContextView.getAmazonEC2Client(); AmazonCloudFormationClient amazonCloudFormationClient = awsClient.createCloudFormationClient(credentialView, regionName); awsCloudWatchService.deleteCloudWatchAlarmsForSystemFailures(stack, regionName, credentialView); waitAndDeleteCloudformationStack(ac, stack, resources, amazonCloudFormationClient); awsComputeResourceService.deleteComputeResources(ac, stack, resources); cleanupEncryptedResources(ac, resources, regionName, amazonEC2Client); deleteKeyPair(ac, stack, amazonEC2Client, credentialView, regionName); deleteLaunchConfiguration(resources, ac); LOGGER.debug("Deleting stack finished"); return awsResourceConnector.check(ac, resources); } }
AwsTerminateService { public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { LOGGER.debug("Deleting stack: {}", ac.getCloudContext().getId()); AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); AuthenticatedContextView authenticatedContextView = new AuthenticatedContextView(ac); String regionName = authenticatedContextView.getRegion(); AmazonEC2Client amazonEC2Client = authenticatedContextView.getAmazonEC2Client(); AmazonCloudFormationClient amazonCloudFormationClient = awsClient.createCloudFormationClient(credentialView, regionName); awsCloudWatchService.deleteCloudWatchAlarmsForSystemFailures(stack, regionName, credentialView); waitAndDeleteCloudformationStack(ac, stack, resources, amazonCloudFormationClient); awsComputeResourceService.deleteComputeResources(ac, stack, resources); cleanupEncryptedResources(ac, resources, regionName, amazonEC2Client); deleteKeyPair(ac, stack, amazonEC2Client, credentialView, regionName); deleteLaunchConfiguration(resources, ac); LOGGER.debug("Deleting stack finished"); return awsResourceConnector.check(ac, resources); }  }
AwsTerminateService { public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { LOGGER.debug("Deleting stack: {}", ac.getCloudContext().getId()); AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); AuthenticatedContextView authenticatedContextView = new AuthenticatedContextView(ac); String regionName = authenticatedContextView.getRegion(); AmazonEC2Client amazonEC2Client = authenticatedContextView.getAmazonEC2Client(); AmazonCloudFormationClient amazonCloudFormationClient = awsClient.createCloudFormationClient(credentialView, regionName); awsCloudWatchService.deleteCloudWatchAlarmsForSystemFailures(stack, regionName, credentialView); waitAndDeleteCloudformationStack(ac, stack, resources, amazonCloudFormationClient); awsComputeResourceService.deleteComputeResources(ac, stack, resources); cleanupEncryptedResources(ac, resources, regionName, amazonEC2Client); deleteKeyPair(ac, stack, amazonEC2Client, credentialView, regionName); deleteLaunchConfiguration(resources, ac); LOGGER.debug("Deleting stack finished"); return awsResourceConnector.check(ac, resources); }  List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources); }
AwsTerminateService { public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { LOGGER.debug("Deleting stack: {}", ac.getCloudContext().getId()); AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); AuthenticatedContextView authenticatedContextView = new AuthenticatedContextView(ac); String regionName = authenticatedContextView.getRegion(); AmazonEC2Client amazonEC2Client = authenticatedContextView.getAmazonEC2Client(); AmazonCloudFormationClient amazonCloudFormationClient = awsClient.createCloudFormationClient(credentialView, regionName); awsCloudWatchService.deleteCloudWatchAlarmsForSystemFailures(stack, regionName, credentialView); waitAndDeleteCloudformationStack(ac, stack, resources, amazonCloudFormationClient); awsComputeResourceService.deleteComputeResources(ac, stack, resources); cleanupEncryptedResources(ac, resources, regionName, amazonEC2Client); deleteKeyPair(ac, stack, amazonEC2Client, credentialView, regionName); deleteLaunchConfiguration(resources, ac); LOGGER.debug("Deleting stack finished"); return awsResourceConnector.check(ac, resources); }  List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources);  }