public void createPlacementGroupsIfDoNotExist(org.excalibur.core.cloud.api.Placement... groups) { if (groups != null) { ListeningExecutorService executor = newListeningDynamicScalingThreadPool(String.format("create-groups-%s", credentials_ .getRegion().getName())); List<Callable<Void>> tasks = newArrayList(); for (final org.excalibur.core.cloud.api.Placement placement : groups) { tasks.add(new Callable<Void>() { @Override public Void call() throws Exception { if (placement != null && !isNullOrEmpty(placement.getGroupName())) { try { new AmazonEC2Client(awsCredentials_).describePlacementGroups(new DescribePlacementGroupsRequest().withGroupNames(placement.getGroupName())); } catch (AmazonClientException exception) { LOG.debug("The group {} is unknown! Provider message: {}", placement.getGroupName(), exception.getMessage()); ec2_.createPlacementGroup(new CreatePlacementGroupRequest() .withGroupName(placement.getGroupName()).withStrategy(PlacementStrategy.Cluster)); } } return null; } }); } invokeAllAndShutdownWhenFinish(tasks, executor); } }
@Override public PlacementGroup createPlacementGroup(CreatePlacementGroupRequest request, ResultCapture<Void> extractor) { ActionResult result = service.performAction("CreatePlacementGroup", request, extractor); if (result == null) return null; return new PlacementGroupImpl(result.getResource()); }
@Override public PlacementGroup createPlacementGroup(String groupName, String strategy , ResultCapture<Void> extractor) { CreatePlacementGroupRequest request = new CreatePlacementGroupRequest() .withGroupName(groupName) .withStrategy(strategy); return createPlacementGroup(request, extractor); }
@Override public void createPlacementGroup(CreatePlacementGroupRequest createPlacementGroupRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
@Override public PlacementGroup createPlacementGroup(CreatePlacementGroupRequest request) { return createPlacementGroup(request, null); }
/** * Performs the <code>CreatePlacementGroup</code> action. * * <p> * * @return The <code>PlacementGroup</code> resource object associated with * the result of this action. * @see CreatePlacementGroupRequest */ com.amazonaws.resources.ec2.PlacementGroup createPlacementGroup( CreatePlacementGroupRequest request);
/** * Performs the <code>CreatePlacementGroup</code> action and use a * ResultCapture to retrieve the low-level client response. * * <p> * * @return The <code>PlacementGroup</code> resource object associated with * the result of this action. * @see CreatePlacementGroupRequest */ com.amazonaws.resources.ec2.PlacementGroup createPlacementGroup( CreatePlacementGroupRequest request, ResultCapture<Void> extractor);