Terminate specified instances (power-on the instances).

@param instanceIDs
IDs of the instances to terminate
@return a list of state changes for the instances
181181
public static List<InstanceStateChange> terminateInstances(final List<String> instanceIDs) {
        // pass any credentials as aws-mock does not authenticate them at all
        AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
        AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);

        // the mock endpoint for ec2 which runs on your computer
        String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/";
        amazonEC2Client.setEndpoint(ec2Endpoint);

        // send the terminate request with args as instance IDs
        TerminateInstancesRequest request = new TerminateInstancesRequest();
        request.withInstanceIds(instanceIDs);
        TerminateInstancesResult result = amazonEC2Client.terminateInstances(request);

        return result.getTerminatingInstances();
    }
509909
def stop_instance(self, instance_id):
        
        instance = self._load_instance(instance_id)
        instance.terminate()
        del self._instances[instance_id]
442045
def delete_instance(self, instance_id):

        '''
            
        '''

        title = '%s.delete_instance' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'instance_id': instance_id
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)

    # report query
        self.iam.printer('Removing instance %s from AWS region %s.' % (instance_id, self.iam.region_name))

    # retrieve state
        old_state = self.check_instance_state(instance_id)

    # discover tags associated with instance id
        tag_list = []
        try:
            response = self.connection.describe_tags(
                Filters=[ { 'Name': 'resource-id', 'Values': [ instance_id ] } ]
            )
            import re
            aws_tag_pattern = re.compile('aws:')
            for i in range(0, len(response['Tags'])):
                if not aws_tag_pattern.findall(response['Tags'][i]['Key']):
                    tag = {}
                    tag['Key'] = response['Tags'][i]['Key']
                    tag['Value'] = response['Tags'][i]['Value']
                    tag_list.append(tag)
        except:
            raise AWSConnectionError(title)

    # remove tags from instance
        try:
            self.connection.delete_tags(
                Resources=[ instance_id ],
                Tags=tag_list
            )
            self.iam.printer('Tags have been deleted from %s.' % instance_id)
        except:
            raise AWSConnectionError(title)

    # stop instance
        try:
            self.connection.stop_instances(
                InstanceIds=[ instance_id ]
            )
        except:
            raise AWSConnectionError(title)

    # terminate instance
        try:
            response = self.connection.terminate_instances(
                InstanceIds=[ instance_id ]
            )
            new_state = response['TerminatingInstances'][0]['CurrentState']['Name']
        except:
            raise AWSConnectionError(title)

    # report outcome and return true
        self.iam.printer('Instance %s was %s.' % (instance_id, old_state))
        self.iam.printer('Instance %s is %s.' % (instance_id, new_state))
        return new_state
1082147
public void setStoppingInstances(java.util.Collection<InstanceStateChange> stoppingInstances) {
        if (stoppingInstances == null) {
            this.stoppingInstances = null;
            return;
        }

        this.stoppingInstances = new com.amazonaws.internal.SdkInternalList<InstanceStateChange>(stoppingInstances);
    }
796399
func (s *DescribeInstancePatchStatesInput) SetInstanceIds(v []*string) *DescribeInstancePatchStatesInput {
	s.InstanceIds = v
	return s
}
936862
public void addInstance(InstanceInfo i) {
        instancesMap.put(i.getId(), i);
        synchronized (instances) {
            instances.remove(i);
            instances.add(i);
            isDirty = true;
        }
    }
153930
public static Delete delete(final Instance... _instances)
    {
        return delete(Arrays.stream(_instances)
                        .map(instance -> instance.getOid())
                        .toArray(String[]::new));
    }
711419
func (s *DetachInstancesInput) SetInstanceIds(v []*string) *DetachInstancesInput {
	s.InstanceIds = v
	return s
}
124793
func (s *EnterStandbyInput) SetInstanceIds(v []*string) *EnterStandbyInput {
	s.InstanceIds = v
	return s
}
1235825
@Invalidate
    public void stop() {
        for (Map.Entry<ServiceRegistration, ExecutorService> entry : instances.entrySet()) {
            entry.getKey().unregister();
            entry.getValue().shutdownNow();
        }
        instances.clear();
    }
195145
public void setInstanceIds(java.util.Collection<InstanceIdDetail> instanceIds) {
        if (instanceIds == null) {
            this.instanceIds = null;
            return;
        }

        this.instanceIds = new java.util.ArrayList<InstanceIdDetail>(instanceIds);
    }
668957
public final InstanceState getInstanceState() {
        return isTerminated() ? InstanceState.TERMINATED
                : (isBooting() ? InstanceState.PENDING
                        : (isStopping() ? InstanceState.STOPPING
                                : (isRunning() ? InstanceState.RUNNING
                                        : InstanceState.STOPPED)));
    }
617168
public static void clear() {
		for (int i = 0; i < index; ++i) {
			instances.get(i).clear();
		}
		index = 0;
	}
647354
def terminate_nodes(self, node_ids):
        """"""
        for node_id in node_ids:
            logger.info("NodeProvider: "
                        "{}: Terminating node".format(node_id))
            self.terminate_node(node_id)
91710
public java.util.List<InstanceStateChange> getStartingInstances() {
        if (startingInstances == null) {
            startingInstances = new com.amazonaws.internal.SdkInternalList<InstanceStateChange>();
        }
        return startingInstances;
    }
597831
def terminate(self, instances, count=0):
        
        if not instances:
            return
        if count > 0:
            instances = self._scale_down(instances, count)
        self.ec2.terminate_instances([i.id for i in instances])
961838
public void setStartingInstances(java.util.Collection<InstanceStateChange> startingInstances) {
        if (startingInstances == null) {
            this.startingInstances = null;
            return;
        }

        this.startingInstances = new com.amazonaws.internal.SdkInternalList<InstanceStateChange>(startingInstances);
    }