Search in sources :

Example 1 with InstanceMonitoring

use of com.amazonaws.services.ec2.model.InstanceMonitoring in project camel by apache.

the class AmazonEC2ClientMock method monitorInstances.

@Override
public MonitorInstancesResult monitorInstances(MonitorInstancesRequest monitorInstancesRequest) {
    MonitorInstancesResult result = new MonitorInstancesResult();
    if (!monitorInstancesRequest.getInstanceIds().isEmpty()) {
        Collection<InstanceMonitoring> coll = new ArrayList();
        Iterator it = monitorInstancesRequest.getInstanceIds().iterator();
        while (it.hasNext()) {
            String id = (String) it.next();
            InstanceMonitoring mon = new InstanceMonitoring();
            mon.setInstanceId(id);
            Monitoring monitoring = new Monitoring();
            monitoring.setState(MonitoringState.Enabled);
            mon.setMonitoring(monitoring);
            coll.add(mon);
        }
        result.setInstanceMonitorings(coll);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) MonitorInstancesResult(com.amazonaws.services.ec2.model.MonitorInstancesResult) InstanceMonitoring(com.amazonaws.services.ec2.model.InstanceMonitoring) InstanceMonitoring(com.amazonaws.services.ec2.model.InstanceMonitoring) Monitoring(com.amazonaws.services.ec2.model.Monitoring)

Example 2 with InstanceMonitoring

use of com.amazonaws.services.ec2.model.InstanceMonitoring in project camel by apache.

the class AmazonEC2ClientMock method unmonitorInstances.

@Override
public UnmonitorInstancesResult unmonitorInstances(UnmonitorInstancesRequest unmonitorInstancesRequest) {
    UnmonitorInstancesResult result = new UnmonitorInstancesResult();
    if (!unmonitorInstancesRequest.getInstanceIds().isEmpty()) {
        Collection<InstanceMonitoring> coll = new ArrayList();
        Iterator it = unmonitorInstancesRequest.getInstanceIds().iterator();
        while (it.hasNext()) {
            String id = (String) it.next();
            InstanceMonitoring mon = new InstanceMonitoring();
            mon.setInstanceId(id);
            Monitoring monitoring = new Monitoring();
            monitoring.setState(MonitoringState.Disabled);
            mon.setMonitoring(monitoring);
            coll.add(mon);
        }
        result.setInstanceMonitorings(coll);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) UnmonitorInstancesResult(com.amazonaws.services.ec2.model.UnmonitorInstancesResult) InstanceMonitoring(com.amazonaws.services.ec2.model.InstanceMonitoring) InstanceMonitoring(com.amazonaws.services.ec2.model.InstanceMonitoring) Monitoring(com.amazonaws.services.ec2.model.Monitoring)

Aggregations

InstanceMonitoring (com.amazonaws.services.ec2.model.InstanceMonitoring)2 Monitoring (com.amazonaws.services.ec2.model.Monitoring)2 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 MonitorInstancesResult (com.amazonaws.services.ec2.model.MonitorInstancesResult)1 UnmonitorInstancesResult (com.amazonaws.services.ec2.model.UnmonitorInstancesResult)1