Unsupported content

 

This version of the product has reached end of support. The documentation is available for your convenience. However, you must be logged in to access it. You will not be able to leave comments.

terminateInstances

terminateInstances method allows you to terminate only the BMC Cloud Lifecycle Management services whose servers are mapped to AWS VMs.

Note

terminateInstances method of CLM AWS SDK allows you to terminate the services and not the individual servers. If you have used a server ID for terminating an instance, then it checks the corresponding service and if it contains only single server object then it terminates that service, if not a CloudException is thrown stating "Service Offering Instance contains more than one Compute Container. Hence, we can't decommission the individual Compute Container as requested."

This operation can be performed by specifying either of following: 

  • Service ID(s) from BMC Cloud Lifecycle Management.
  • Service name(s) from BMC Cloud Lifecycle Management.
  • Server instance ID(s) from BMC Cloud Lifecycle Management. 

The following table depicts how terminateInstances method is used: 

UsageDescription
To execute using server instance ID(s)
TerminateInstancesRequest terminateInstancesRequest = new TerminateInstancesRequest();
     List<String> instanceIdsList = new ArrayList<String>();
     instanceIdsList.add("dfbb7d4f-196e-462a-b0c6-4f96e51eccbd"); 
     // Pass Server instance id here
     terminateInstancesRequest.setInstanceIds(instanceIdsList);
     clmEC2Client.terminateInstances(terminateInstancesRequest); 
To execute using service ID(s)
TerminateServicesRequest servicesRequest = new TerminateServicesRequest();
     List<String> serviceIdList = new ArrayList<String>();
     // Pass Service Ids here
     serviceIdList.add("ec37bff8-8886-4ed2-bb92-249deae0fcff");
     servicesRequest.setServiceIds(serviceIdList);
     clmEC2Client.terminateInstances(servicesRequest);
To execute using service name(s)
TerminateServicesRequest servicesRequest = new TerminateServicesRequest();
     List<String> serviceNameList = new ArrayList<String>();
     serviceNameList.add("WinTestService");
     servicesRequest.setServiceNames(serviceNameList);
     clmEC2Client.terminateInstances(servicesRequest);


Before you begin

Prior to using this CLM AWS SDK method, ensure that the following prerequisites are met:

Request

Using com.amazonaws.services.ec2.model.TerminateInstancesRequest

MethodUsage as per AWS SDKUsage as per CLM AWS SDKRemarks
setInstanceIds(Collection<String> instanceIds)
One or more instance IDsOne or more server IDs from BMC Cloud Lifecycle Management. This is obtained from the getInstanceId() method from com.bmc.cloud.sdk.aws.model.ServerInstance  
withInstanceIds(Collection<String> instanceIds)
One or more instance IDsOne or more server IDs from BMC Cloud Lifecycle Management. This is obtained from the getInstanceId() method from com.bmc.cloud.sdk.aws.model.ServerInstance

Using com.bmc.cloud.sdk.aws.model.TerminateServicesRequest

Extendscom.amazonaws.services.ec2.model.TerminateInstancesRequest

MethodUsage as per AWS SDKUsage as per CLM AWS SDKRemarks
setServiceIds(final List<String> serviceIds)
Not usedOne or more service IDs from BMC Cloud Lifecycle Management.   This is obtained from the getServiceId() method from com.bmc.cloud.sdk.aws.model.ServerInstance  
setServiceNames(List<String> serviceNames)
Not usedOne or more service names from BMC Cloud Lifecycle Management.This is obtained from the getServiceName() method from com.bmc.cloud.sdk.aws.model.ServerInstance

Response

com.amazonaws.services.ec2.model.TerminateInstancesResult

Extends: None

MethodBelongs ToUsage as per AWS SDKUsage as per CLM AWS SDKRemarks
getTerminatingInstances() 
AWS 
  • getCurrentState()
  • getInstanceId() 
  • getPreviousState() 
  • getCurrentState()
  • getInstanceId() 
  • getPreviousState()
PENDING,RUNNING, 
SHUTTING_DOWN,TERMINATED, 
STOPPING,STOPPED 

Instance ID is mapped to server ID.

Related topic

CLM AWS SDK use cases

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments