public Request<DescribeVpnGatewaysRequest> marshall(
      DescribeVpnGatewaysRequest describeVpnGatewaysRequest) {

    if (describeVpnGatewaysRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeVpnGatewaysRequest> request =
        new DefaultRequest<DescribeVpnGatewaysRequest>(describeVpnGatewaysRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeVpnGateways");
    request.addParameter("Version", "2013-10-01");

    java.util.List<String> vpnGatewayIdsList = describeVpnGatewaysRequest.getVpnGatewayIds();
    int vpnGatewayIdsListIndex = 1;

    for (String vpnGatewayIdsListValue : vpnGatewayIdsList) {
      if (vpnGatewayIdsListValue != null) {
        request.addParameter(
            "VpnGatewayId." + vpnGatewayIdsListIndex,
            StringUtils.fromString(vpnGatewayIdsListValue));
      }

      vpnGatewayIdsListIndex++;
    }

    java.util.List<Filter> filtersList = describeVpnGatewaysRequest.getFilters();
    int filtersListIndex = 1;

    for (Filter filtersListValue : filtersList) {
      Filter filterMember = filtersListValue;
      if (filterMember != null) {
        if (filterMember.getName() != null) {
          request.addParameter(
              "Filter." + filtersListIndex + ".Name",
              StringUtils.fromString(filterMember.getName()));
        }

        java.util.List<String> valuesList = filterMember.getValues();
        int valuesListIndex = 1;

        for (String valuesListValue : valuesList) {
          if (valuesListValue != null) {
            request.addParameter(
                "Filter." + filtersListIndex + ".Value." + valuesListIndex,
                StringUtils.fromString(valuesListValue));
          }

          valuesListIndex++;
        }
      }

      filtersListIndex++;
    }

    return request;
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof DescribeVpnGatewaysRequest == false) return false;
    DescribeVpnGatewaysRequest other = (DescribeVpnGatewaysRequest) obj;

    if (other.getVpnGatewayIds() == null ^ this.getVpnGatewayIds() == null) return false;
    if (other.getVpnGatewayIds() != null
        && other.getVpnGatewayIds().equals(this.getVpnGatewayIds()) == false) return false;
    if (other.getFilters() == null ^ this.getFilters() == null) return false;
    if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false)
      return false;
    return true;
  }
示例#3
0
  @Override
  public void doWork() throws BuildException {
    DescribeVpnGatewaysRequest request = new DescribeVpnGatewaysRequest();

    if (gatewayIds != null) {
      request.setVpnGatewayIds(CollectionsHelper.asList(gatewayIds));
    }

    if (filters != null) {
      request.setFilters(filters);
    }

    DescribeVpnGatewaysResult result = getEc2Client().describeVpnGateways(request);

    for (VpnGateway gateway : result.getVpnGateways()) {
      this.setPropertyThreadSafe(property, gateway.toString());

      for (Task task : tasks) {
        task.perform();
      }
    }
  }