Java 类com.amazonaws.services.ec2.model.DescribePlacementGroupsRequest 实例源码

项目:director-aws-plugin    文件:EC2InstanceTemplateConfigurationValidator.java   
/**
 * Validates the configured placement group.
 *
 * @param client              the EC2 client
 * @param configuration       the configuration to be validated
 * @param accumulator         the exception condition accumulator
 * @param localizationContext the localization context
 */
@VisibleForTesting
void checkPlacementGroup(AmazonEC2Client client,
    Configured configuration,
    PluginExceptionConditionAccumulator accumulator,
    LocalizationContext localizationContext) {

  String placementGroup =
      configuration.getConfigurationValue(PLACEMENT_GROUP, localizationContext);

  if (placementGroup != null) {
    LOG.info(">> Describing placement group '{}'", placementGroup);

    try {
      DescribePlacementGroupsResult result = client.describePlacementGroups(
          new DescribePlacementGroupsRequest().withGroupNames(placementGroup));

      checkCount(accumulator, PLACEMENT_GROUP, localizationContext, "Placement group",
          result.getPlacementGroups());
    } catch (AmazonServiceException e) {
      if (e.getErrorCode().startsWith(INVALID_PLACEMENT_GROUP_ID)) {
        addError(accumulator, PLACEMENT_GROUP, localizationContext,
            null, INVALID_PLACEMENT_GROUP_MSG, placementGroup);
      } else {
        throw Throwables.propagate(e);
      }
    }
  }
}
项目:dohko    文件:EC2.java   
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);
    }
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public PlacementGroupCollection getPlacementGroups(
        DescribePlacementGroupsRequest request) {

    ResourceCollectionImpl result = service.getCollection("PlacementGroups",
            request);

    if (result == null) return null;
    return new PlacementGroupCollectionImpl(result);
}
项目:clouck    文件:Ec2WrapperImpl.java   
@Override
public List<AbstractResource<?>> describePlacementGroups(Account account, Region region, DateTime dt, Ec2Filter... filters) {
    AmazonEC2 ec2 = findClient(account, region);

    DescribePlacementGroupsRequest req = new DescribePlacementGroupsRequest();
    for (Ec2Filter filter : filters) {
        Filter f = new Filter().withName(filter.getName()).withValues(filter.getValues());
        req.withFilters(f);
    }

    log.debug("start describing placement groups for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    DescribePlacementGroupsResult res = ec2.describePlacementGroups(req);

    return converter.toEc2PlacementGroups(res.getPlacementGroups(), account.getId(), region, dt);
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public DescribePlacementGroupsResult describePlacementGroups(DescribePlacementGroupsRequest describePlacementGroupsRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:PlacementGroupImpl.java   
@Override
public boolean load(DescribePlacementGroupsRequest request) {
    return load(request, null);
}
项目:aws-sdk-java-resources    文件:PlacementGroupImpl.java   
@Override
public boolean load(DescribePlacementGroupsRequest request,
        ResultCapture<DescribePlacementGroupsResult> extractor) {

    return resource.load(request, extractor);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public PlacementGroupCollection getPlacementGroups() {
    return getPlacementGroups((DescribePlacementGroupsRequest)null);
}
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * Retrieves the PlacementGroups collection referenced by this resource.
 */
PlacementGroupCollection getPlacementGroups(DescribePlacementGroupsRequest
        request);
项目:aws-sdk-java-resources    文件:PlacementGroup.java   
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet.
 * The following request parameters will be populated from the data of this
 * <code>PlacementGroup</code> resource, and any conflicting parameter value
 * set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>GroupNames.0</code></b>
 *         - mapped from the <code>Name</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see DescribePlacementGroupsRequest
 */
boolean load(DescribePlacementGroupsRequest request);
项目:aws-sdk-java-resources    文件:PlacementGroup.java   
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet, and use a ResultCapture to retrieve the low-level
 * client response
 * The following request parameters will be populated from the data of this
 * <code>PlacementGroup</code> resource, and any conflicting parameter value
 * set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>GroupNames.0</code></b>
 *         - mapped from the <code>Name</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see DescribePlacementGroupsRequest
 */
boolean load(DescribePlacementGroupsRequest request,
        ResultCapture<DescribePlacementGroupsResult> extractor);