コード例 #1
0
  public Request<DescribeVpcsRequest> marshall(DescribeVpcsRequest describeVpcsRequest) {

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

    Request<DescribeVpcsRequest> request =
        new DefaultRequest<DescribeVpcsRequest>(describeVpcsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeVpcs");
    request.addParameter("Version", "2016-04-01");
    request.setHttpMethod(HttpMethodName.POST);

    com.amazonaws.internal.SdkInternalList<String> vpcIdsList =
        (com.amazonaws.internal.SdkInternalList<String>) describeVpcsRequest.getVpcIds();
    if (!vpcIdsList.isEmpty() || !vpcIdsList.isAutoConstruct()) {
      int vpcIdsListIndex = 1;

      for (String vpcIdsListValue : vpcIdsList) {
        if (vpcIdsListValue != null) {
          request.addParameter("VpcId." + vpcIdsListIndex, StringUtils.fromString(vpcIdsListValue));
        }
        vpcIdsListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<Filter> filtersList =
        (com.amazonaws.internal.SdkInternalList<Filter>) describeVpcsRequest.getFilters();
    if (!filtersList.isEmpty() || !filtersList.isAutoConstruct()) {
      int filtersListIndex = 1;

      for (Filter filtersListValue : filtersList) {

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

        com.amazonaws.internal.SdkInternalList<String> valuesList =
            (com.amazonaws.internal.SdkInternalList<String>) filtersListValue.getValues();
        if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) {
          int valuesListIndex = 1;

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

    return request;
  }
コード例 #2
0
  public Request<DescribeVpcsRequest> marshall(DescribeVpcsRequest describeVpcsRequest) {

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

    Request<DescribeVpcsRequest> request =
        new DefaultRequest<DescribeVpcsRequest>(describeVpcsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeVpcs");
    request.addParameter("Version", "2012-12-01");

    java.util.List<String> vpcIdsList = describeVpcsRequest.getVpcIds();
    int vpcIdsListIndex = 1;

    for (String vpcIdsListValue : vpcIdsList) {
      if (vpcIdsListValue != null) {
        request.addParameter("VpcId." + vpcIdsListIndex, StringUtils.fromString(vpcIdsListValue));
      }

      vpcIdsListIndex++;
    }

    java.util.List<Filter> filtersList = describeVpcsRequest.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;
  }