public Request<DescribeNetworkInterfacesRequest> marshall(
      DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest) {

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

    Request<DescribeNetworkInterfacesRequest> request =
        new DefaultRequest<DescribeNetworkInterfacesRequest>(
            describeNetworkInterfacesRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeNetworkInterfaces");
    request.addParameter("Version", "2015-10-01");

    java.util.List<String> networkInterfaceIdsList =
        describeNetworkInterfacesRequest.getNetworkInterfaceIds();
    int networkInterfaceIdsListIndex = 1;

    for (String networkInterfaceIdsListValue : networkInterfaceIdsList) {
      if (networkInterfaceIdsListValue != null) {
        request.addParameter(
            "NetworkInterfaceId." + networkInterfaceIdsListIndex,
            StringUtils.fromString(networkInterfaceIdsListValue));
      }

      networkInterfaceIdsListIndex++;
    }

    java.util.List<Filter> filtersList = describeNetworkInterfacesRequest.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;
  }
  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;
  }
  public Request<DescribeReservedInstancesListingsRequest> marshall(
      DescribeReservedInstancesListingsRequest describeReservedInstancesListingsRequest) {

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

    Request<DescribeReservedInstancesListingsRequest> request =
        new DefaultRequest<DescribeReservedInstancesListingsRequest>(
            describeReservedInstancesListingsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeReservedInstancesListings");
    request.addParameter("Version", "2014-06-15");

    if (describeReservedInstancesListingsRequest.getReservedInstancesId() != null) {
      request.addParameter(
          "ReservedInstancesId",
          StringUtils.fromString(
              describeReservedInstancesListingsRequest.getReservedInstancesId()));
    }
    if (describeReservedInstancesListingsRequest.getReservedInstancesListingId() != null) {
      request.addParameter(
          "ReservedInstancesListingId",
          StringUtils.fromString(
              describeReservedInstancesListingsRequest.getReservedInstancesListingId()));
    }

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

    for (Filter filtersListValue : filtersList) {
      Filter filterMember = filtersListValue;
      if (filterMember != null) {
        if (filterMember.getName() != null) {
          request.addParameter(
              "Filters." + 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(
                "Filters." + filtersListIndex + ".Value." + valuesListIndex,
                StringUtils.fromString(valuesListValue));
          }

          valuesListIndex++;
        }
      }

      filtersListIndex++;
    }

    return request;
  }
  public Request<DescribePlacementGroupsRequest> marshall(
      DescribePlacementGroupsRequest describePlacementGroupsRequest) {

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

    Request<DescribePlacementGroupsRequest> request =
        new DefaultRequest<DescribePlacementGroupsRequest>(
            describePlacementGroupsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribePlacementGroups");
    request.addParameter("Version", "2012-07-20");

    java.util.List<String> groupNamesList = describePlacementGroupsRequest.getGroupNames();
    int groupNamesListIndex = 1;

    for (String groupNamesListValue : groupNamesList) {
      if (groupNamesListValue != null) {
        request.addParameter(
            "GroupName." + groupNamesListIndex, StringUtils.fromString(groupNamesListValue));
      }

      groupNamesListIndex++;
    }

    java.util.List<Filter> filtersList = describePlacementGroupsRequest.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;
  }
  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;
  }
  public Request<DescribeAddressesRequest> marshall(
      DescribeAddressesRequest describeAddressesRequest) {
    Request<DescribeAddressesRequest> request =
        new DefaultRequest<DescribeAddressesRequest>(describeAddressesRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeAddresses");
    request.addParameter("Version", "2011-05-15");
    if (describeAddressesRequest != null) {
      java.util.List<String> publicIpsList = describeAddressesRequest.getPublicIps();
      int publicIpsListIndex = 1;

      for (String publicIpsListValue : publicIpsList) {
        if (publicIpsListValue != null) {
          request.addParameter(
              "PublicIp." + publicIpsListIndex, StringUtils.fromString(publicIpsListValue));
        }
        publicIpsListIndex++;
      }
    }

    if (describeAddressesRequest != null) {
      java.util.List<Filter> filtersList = describeAddressesRequest.getFilters();
      int filtersListIndex = 1;
      for (Filter filtersListValue : filtersList) {
        if (filtersListValue != null) {
          if (filtersListValue.getName() != null) {
            request.addParameter(
                "Filter." + filtersListIndex + ".Name",
                StringUtils.fromString(filtersListValue.getName()));
          }
        }
        if (filtersListValue != null) {
          java.util.List<String> valuesList = filtersListValue.getValues();
          int valuesListIndex = 1;

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

        filtersListIndex++;
      }
    }
    if (describeAddressesRequest != null) {
      java.util.List<String> allocationIdsList = describeAddressesRequest.getAllocationIds();
      int allocationIdsListIndex = 1;

      for (String allocationIdsListValue : allocationIdsList) {
        if (allocationIdsListValue != null) {
          request.addParameter(
              "AllocationId." + allocationIdsListIndex,
              StringUtils.fromString(allocationIdsListValue));
        }
        allocationIdsListIndex++;
      }
    }

    return request;
  }
  public Request<DescribeSnapshotsRequest> marshall(
      DescribeSnapshotsRequest describeSnapshotsRequest) {

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

    Request<DescribeSnapshotsRequest> request =
        new DefaultRequest<DescribeSnapshotsRequest>(describeSnapshotsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeSnapshots");
    request.addParameter("Version", "2013-07-15");

    java.util.List<String> snapshotIdsList = describeSnapshotsRequest.getSnapshotIds();
    int snapshotIdsListIndex = 1;

    for (String snapshotIdsListValue : snapshotIdsList) {
      if (snapshotIdsListValue != null) {
        request.addParameter(
            "SnapshotId." + snapshotIdsListIndex, StringUtils.fromString(snapshotIdsListValue));
      }

      snapshotIdsListIndex++;
    }

    java.util.List<String> ownerIdsList = describeSnapshotsRequest.getOwnerIds();
    int ownerIdsListIndex = 1;

    for (String ownerIdsListValue : ownerIdsList) {
      if (ownerIdsListValue != null) {
        request.addParameter(
            "Owner." + ownerIdsListIndex, StringUtils.fromString(ownerIdsListValue));
      }

      ownerIdsListIndex++;
    }

    java.util.List<String> restorableByUserIdsList =
        describeSnapshotsRequest.getRestorableByUserIds();
    int restorableByUserIdsListIndex = 1;

    for (String restorableByUserIdsListValue : restorableByUserIdsList) {
      if (restorableByUserIdsListValue != null) {
        request.addParameter(
            "RestorableBy." + restorableByUserIdsListIndex,
            StringUtils.fromString(restorableByUserIdsListValue));
      }

      restorableByUserIdsListIndex++;
    }

    java.util.List<Filter> filtersList = describeSnapshotsRequest.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;
  }
  public Request<DescribeSecurityGroupsRequest> marshall(
      DescribeSecurityGroupsRequest describeSecurityGroupsRequest) {

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

    Request<DescribeSecurityGroupsRequest> request =
        new DefaultRequest<DescribeSecurityGroupsRequest>(
            describeSecurityGroupsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeSecurityGroups");
    request.addParameter("Version", "2016-11-15");
    request.setHttpMethod(HttpMethodName.POST);

    com.amazonaws.internal.SdkInternalList<String> describeSecurityGroupsRequestGroupNamesList =
        (com.amazonaws.internal.SdkInternalList<String>)
            describeSecurityGroupsRequest.getGroupNames();
    if (!describeSecurityGroupsRequestGroupNamesList.isEmpty()
        || !describeSecurityGroupsRequestGroupNamesList.isAutoConstruct()) {
      int groupNamesListIndex = 1;

      for (String describeSecurityGroupsRequestGroupNamesListValue :
          describeSecurityGroupsRequestGroupNamesList) {
        if (describeSecurityGroupsRequestGroupNamesListValue != null) {
          request.addParameter(
              "GroupName." + groupNamesListIndex,
              StringUtils.fromString(describeSecurityGroupsRequestGroupNamesListValue));
        }
        groupNamesListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<String> describeSecurityGroupsRequestGroupIdsList =
        (com.amazonaws.internal.SdkInternalList<String>)
            describeSecurityGroupsRequest.getGroupIds();
    if (!describeSecurityGroupsRequestGroupIdsList.isEmpty()
        || !describeSecurityGroupsRequestGroupIdsList.isAutoConstruct()) {
      int groupIdsListIndex = 1;

      for (String describeSecurityGroupsRequestGroupIdsListValue :
          describeSecurityGroupsRequestGroupIdsList) {
        if (describeSecurityGroupsRequestGroupIdsListValue != null) {
          request.addParameter(
              "GroupId." + groupIdsListIndex,
              StringUtils.fromString(describeSecurityGroupsRequestGroupIdsListValue));
        }
        groupIdsListIndex++;
      }
    }

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

      for (Filter describeSecurityGroupsRequestFiltersListValue :
          describeSecurityGroupsRequestFiltersList) {

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

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

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

    return request;
  }
  public Request<DescribeInstanceStatusRequest> marshall(
      DescribeInstanceStatusRequest describeInstanceStatusRequest) {

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

    Request<DescribeInstanceStatusRequest> request =
        new DefaultRequest<DescribeInstanceStatusRequest>(
            describeInstanceStatusRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeInstanceStatus");
    request.addParameter("Version", "2015-10-01");

    java.util.List<String> instanceIdsList = describeInstanceStatusRequest.getInstanceIds();
    int instanceIdsListIndex = 1;

    for (String instanceIdsListValue : instanceIdsList) {
      if (instanceIdsListValue != null) {
        request.addParameter(
            "InstanceId." + instanceIdsListIndex, StringUtils.fromString(instanceIdsListValue));
      }

      instanceIdsListIndex++;
    }

    java.util.List<Filter> filtersList = describeInstanceStatusRequest.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++;
    }
    if (describeInstanceStatusRequest.getNextToken() != null) {
      request.addParameter(
          "NextToken", StringUtils.fromString(describeInstanceStatusRequest.getNextToken()));
    }
    if (describeInstanceStatusRequest.getMaxResults() != null) {
      request.addParameter(
          "MaxResults", StringUtils.fromInteger(describeInstanceStatusRequest.getMaxResults()));
    }
    if (describeInstanceStatusRequest.isIncludeAllInstances() != null) {
      request.addParameter(
          "IncludeAllInstances",
          StringUtils.fromBoolean(describeInstanceStatusRequest.isIncludeAllInstances()));
    }

    return request;
  }