public Request<DescribeImagesRequest> marshall(DescribeImagesRequest describeImagesRequest) {

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

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

    com.amazonaws.internal.SdkInternalList<String> imageIdsList =
        (com.amazonaws.internal.SdkInternalList<String>) describeImagesRequest.getImageIds();
    if (!imageIdsList.isEmpty() || !imageIdsList.isAutoConstruct()) {
      int imageIdsListIndex = 1;

      for (String imageIdsListValue : imageIdsList) {
        if (imageIdsListValue != null) {
          request.addParameter(
              "ImageId." + imageIdsListIndex, StringUtils.fromString(imageIdsListValue));
        }
        imageIdsListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<String> ownersList =
        (com.amazonaws.internal.SdkInternalList<String>) describeImagesRequest.getOwners();
    if (!ownersList.isEmpty() || !ownersList.isAutoConstruct()) {
      int ownersListIndex = 1;

      for (String ownersListValue : ownersList) {
        if (ownersListValue != null) {
          request.addParameter("Owner." + ownersListIndex, StringUtils.fromString(ownersListValue));
        }
        ownersListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<String> executableUsersList =
        (com.amazonaws.internal.SdkInternalList<String>) describeImagesRequest.getExecutableUsers();
    if (!executableUsersList.isEmpty() || !executableUsersList.isAutoConstruct()) {
      int executableUsersListIndex = 1;

      for (String executableUsersListValue : executableUsersList) {
        if (executableUsersListValue != null) {
          request.addParameter(
              "ExecutableBy." + executableUsersListIndex,
              StringUtils.fromString(executableUsersListValue));
        }
        executableUsersListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<Filter> filtersList =
        (com.amazonaws.internal.SdkInternalList<Filter>) describeImagesRequest.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;
  }
  public Request<DescribeImagesRequest> marshall(DescribeImagesRequest describeImagesRequest) {

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

    Request<DescribeImagesRequest> request =
        new DefaultRequest<DescribeImagesRequest>(describeImagesRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeImages");
    request.addParameter("Version", "2012-10-01");

    java.util.List<String> imageIdsList = describeImagesRequest.getImageIds();
    int imageIdsListIndex = 1;

    for (String imageIdsListValue : imageIdsList) {
      if (imageIdsListValue != null) {
        request.addParameter(
            "ImageId." + imageIdsListIndex, StringUtils.fromString(imageIdsListValue));
      }

      imageIdsListIndex++;
    }

    java.util.List<String> ownersList = describeImagesRequest.getOwners();
    int ownersListIndex = 1;

    for (String ownersListValue : ownersList) {
      if (ownersListValue != null) {
        request.addParameter("Owner." + ownersListIndex, StringUtils.fromString(ownersListValue));
      }

      ownersListIndex++;
    }

    java.util.List<String> executableUsersList = describeImagesRequest.getExecutableUsers();
    int executableUsersListIndex = 1;

    for (String executableUsersListValue : executableUsersList) {
      if (executableUsersListValue != null) {
        request.addParameter(
            "ExecutableBy." + executableUsersListIndex,
            StringUtils.fromString(executableUsersListValue));
      }

      executableUsersListIndex++;
    }

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