private void unmonitorInstances(AmazonEC2Client ec2Client, Exchange exchange) { Collection instanceIds; UnmonitorInstancesRequest request = new UnmonitorInstancesRequest(); if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_IDS))) { instanceIds = exchange.getIn().getHeader(EC2Constants.INSTANCES_IDS, Collection.class); request.withInstanceIds(instanceIds); } else { throw new IllegalArgumentException("Instances Ids must be specified"); } UnmonitorInstancesResult result; try { result = ec2Client.unmonitorInstances(request); } catch (AmazonServiceException ase) { LOG.trace("Unmonitor Instances command returned the error code {}", ase.getErrorCode()); throw ase; } LOG.trace("Stop Monitoring instances with Ids [{}] ", Arrays.toString(instanceIds.toArray())); Message message = getMessageForResponse(exchange); message.setBody(result); }
@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; }
@Override public UnmonitorInstancesResult unmonitor(UnmonitorInstancesRequest request, ResultCapture<UnmonitorInstancesResult> extractor) { ActionResult result = resource.performAction("Unmonitor", request, extractor); if (result == null) return null; return (UnmonitorInstancesResult) result.getData(); }
@Override public UnmonitorInstancesResult unmonitor( ResultCapture<UnmonitorInstancesResult> extractor) { UnmonitorInstancesRequest request = new UnmonitorInstancesRequest(); return unmonitor(request, extractor); }
@Override public UnmonitorInstancesResult unmonitorInstances(UnmonitorInstancesRequest unmonitorInstancesRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
@Override public UnmonitorInstancesResult unmonitor(UnmonitorInstancesRequest request) { return unmonitor(request, null); }
/** * Performs the <code>Unmonitor</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>Instance</code> resource, and any conflicting parameter value set * in the request will be overridden: * <ul> * <li> * <b><code>InstanceIds.0</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @return The response of the low-level client operation associated with * this resource action. * @see UnmonitorInstancesRequest */ UnmonitorInstancesResult unmonitor(UnmonitorInstancesRequest request);
/** * Performs the <code>Unmonitor</code> action and use a ResultCapture to * retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>Instance</code> resource, and any conflicting parameter value set * in the request will be overridden: * <ul> * <li> * <b><code>InstanceIds.0</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @return The response of the low-level client operation associated with * this resource action. * @see UnmonitorInstancesRequest */ UnmonitorInstancesResult unmonitor(UnmonitorInstancesRequest request, ResultCapture<UnmonitorInstancesResult> extractor);