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

项目:aws-sdk-java-resources    文件:VpcImpl.java   
@Override
public NetworkAclCollection getNetworkAcls(DescribeNetworkAclsRequest
        request) {

    ResourceCollectionImpl result = resource.getCollection("NetworkAcls",
            request);

    if (result == null) return null;
    return new NetworkAclCollectionImpl(result);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public NetworkAclCollection getNetworkAcls(DescribeNetworkAclsRequest
        request) {

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

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

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

    log.debug("start describing network acls for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    DescribeNetworkAclsResult res = ec2.describeNetworkAcls(req);

    return converter.toVpcNetworkAcls(res.getNetworkAcls(), account.getId(), region, dt);
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public DescribeNetworkAclsResult describeNetworkAcls(DescribeNetworkAclsRequest describeNetworkAclsRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:director-aws-plugin    文件:EC2NetworkValidator.java   
/**
 * Validates the network ACL against the pre-defined network rules.
 *
 * <p>
 * For more information about network ACLs, see <a
 * href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html">Network ACLs</a> in the <i>Amazon
 * Virtual Private Cloud User Guide</i>.
 * </p>
 *
 * @param client              the EC2 client
 * @param configuration       the configuration to be validated
 * @param accumulator         the exception condition accumulator
 * @param localizationContext the localization context
 */
private void checkNetworkACL(AmazonEC2Client client,
                             Configured configuration,
                             PluginExceptionConditionAccumulator accumulator,
                             LocalizationContext localizationContext) {
  String subnetId = configuration.getConfigurationValue(SUBNET_ID, localizationContext);
  DescribeNetworkAclsResult aclResult;
  LOG.info(">> Describing network ACL associated with subnet '{}'", subnetId);
  try {
    aclResult = client.describeNetworkAcls(
        new DescribeNetworkAclsRequest().withFilters(
            new Filter().withName("association.subnet-id").withValues(subnetId)
        )
    );
  } catch (AmazonServiceException e) {
    // Due to backward compatibility, we cannot mandate the IAM permssion:
    // ec2:DescribeNetworkAcls in customers' accounts and have to fail the
    // above AWS call gracefully, which means the NetworkACL validation is
    // optional now.
    // We have logged a ticket, https://jira.cloudera.com/browse/CLOUD-5345,
    // to track it, and will make this validation mandatory later.
    LOG.warn("Failed to retrieve the network ACL for subnet: " + subnetId, e);
    LOG.warn("Skipping network ACL validation");
    return;
  }
  List<NetworkAcl> aclList = aclResult.getNetworkAcls();
  // Each subnet must be associated with one and only one network ACL.
  if (aclList.isEmpty()) {
    LOG.error(String.format(EMPTY_NETWORK_ACL, subnetId));
    addError(accumulator, SUBNET_ID, localizationContext, null,
        EMPTY_NETWORK_ACL, subnetId);
    return;
  }
  if (aclList.size() > 1) {
    List<String> aclIds = FluentIterable.from(aclList)
        .transform(new Function<NetworkAcl, String>() {
          @Override
          public String apply(NetworkAcl input) {
            return input.getNetworkAclId();
          }
        })
        .toList();
    LOG.error(String.format(MORE_THAN_ONE_NETWORK_ACL, aclIds, subnetId));
    addError(accumulator, SUBNET_ID, localizationContext, null,
        MORE_THAN_ONE_NETWORK_ACL, aclIds, subnetId);
    return;
  }

  NetworkAcl networkAcl = aclList.get(0);

  for (final Direction direction : Direction.values()) {
    Iterable<NetworkAclEntry> aclEntries = FluentIterable.from(networkAcl.getEntries())
        .filter(new Predicate<NetworkAclEntry>() {
          @Override
          public boolean apply(NetworkAclEntry aclEntry) {
            return direction == Direction.INBOUND
                ? !aclEntry.isEgress()
                : aclEntry.isEgress();
          }
        })
        .toSortedList(new NetworkAclEntryComparator());

    checkRulesForNetworkAclEntries(networkAcl.getNetworkAclId(), aclEntries, direction,
        accumulator, localizationContext);
  }
}
项目:aws-sdk-java-resources    文件:NetworkAclImpl.java   
@Override
public boolean load(DescribeNetworkAclsRequest request) {
    return load(request, null);
}
项目:aws-sdk-java-resources    文件:NetworkAclImpl.java   
@Override
public boolean load(DescribeNetworkAclsRequest request,
        ResultCapture<DescribeNetworkAclsResult> extractor) {

    return resource.load(request, extractor);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public NetworkAclCollection getNetworkAcls() {
    return getNetworkAcls((DescribeNetworkAclsRequest)null);
}
项目:aws-sdk-java-resources    文件:Vpc.java   
/**
 * Retrieves the NetworkAcls collection referenced by this resource.
 */
NetworkAclCollection getNetworkAcls(DescribeNetworkAclsRequest request);
项目:aws-sdk-java-resources    文件:NetworkAcl.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>NetworkAcl</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>NetworkAclIds.0</code></b>
 *         - mapped from the <code>Id</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 DescribeNetworkAclsRequest
 */
boolean load(DescribeNetworkAclsRequest request);
项目:aws-sdk-java-resources    文件:NetworkAcl.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>NetworkAcl</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>NetworkAclIds.0</code></b>
 *         - mapped from the <code>Id</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 DescribeNetworkAclsRequest
 */
boolean load(DescribeNetworkAclsRequest request,
        ResultCapture<DescribeNetworkAclsResult> extractor);
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * Retrieves the NetworkAcls collection referenced by this resource.
 */
NetworkAclCollection getNetworkAcls(DescribeNetworkAclsRequest request);