public Request<StopInstancesRequest> marshall(StopInstancesRequest stopInstancesRequest) {

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

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

    com.amazonaws.internal.SdkInternalList<String> instanceIdsList =
        (com.amazonaws.internal.SdkInternalList<String>) stopInstancesRequest.getInstanceIds();
    if (!instanceIdsList.isEmpty() || !instanceIdsList.isAutoConstruct()) {
      int instanceIdsListIndex = 1;

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

    if (stopInstancesRequest.getForce() != null) {
      request.addParameter("Force", StringUtils.fromBoolean(stopInstancesRequest.getForce()));
    }

    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<PurchaseScheduledInstancesRequest> marshall(
      PurchaseScheduledInstancesRequest purchaseScheduledInstancesRequest) {

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

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

    request.addParameter(
        "ClientToken",
        IdempotentUtils.resolveString(purchaseScheduledInstancesRequest.getClientToken()));

    com.amazonaws.internal.SdkInternalList<PurchaseRequest>
        purchaseScheduledInstancesRequestPurchaseRequestsList =
            (com.amazonaws.internal.SdkInternalList<PurchaseRequest>)
                purchaseScheduledInstancesRequest.getPurchaseRequests();
    if (!purchaseScheduledInstancesRequestPurchaseRequestsList.isEmpty()
        || !purchaseScheduledInstancesRequestPurchaseRequestsList.isAutoConstruct()) {
      int purchaseRequestsListIndex = 1;

      for (PurchaseRequest purchaseScheduledInstancesRequestPurchaseRequestsListValue :
          purchaseScheduledInstancesRequestPurchaseRequestsList) {

        if (purchaseScheduledInstancesRequestPurchaseRequestsListValue.getPurchaseToken() != null) {
          request.addParameter(
              "PurchaseRequest." + purchaseRequestsListIndex + ".PurchaseToken",
              StringUtils.fromString(
                  purchaseScheduledInstancesRequestPurchaseRequestsListValue.getPurchaseToken()));
        }

        if (purchaseScheduledInstancesRequestPurchaseRequestsListValue.getInstanceCount() != null) {
          request.addParameter(
              "PurchaseRequest." + purchaseRequestsListIndex + ".InstanceCount",
              StringUtils.fromInteger(
                  purchaseScheduledInstancesRequestPurchaseRequestsListValue.getInstanceCount()));
        }
        purchaseRequestsListIndex++;
      }
    }

    return request;
  }
  public Request<CancelSpotFleetRequestsRequest> marshall(
      CancelSpotFleetRequestsRequest cancelSpotFleetRequestsRequest) {

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

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

    com.amazonaws.internal.SdkInternalList<String>
        cancelSpotFleetRequestsRequestSpotFleetRequestIdsList =
            (com.amazonaws.internal.SdkInternalList<String>)
                cancelSpotFleetRequestsRequest.getSpotFleetRequestIds();
    if (!cancelSpotFleetRequestsRequestSpotFleetRequestIdsList.isEmpty()
        || !cancelSpotFleetRequestsRequestSpotFleetRequestIdsList.isAutoConstruct()) {
      int spotFleetRequestIdsListIndex = 1;

      for (String cancelSpotFleetRequestsRequestSpotFleetRequestIdsListValue :
          cancelSpotFleetRequestsRequestSpotFleetRequestIdsList) {
        if (cancelSpotFleetRequestsRequestSpotFleetRequestIdsListValue != null) {
          request.addParameter(
              "SpotFleetRequestId." + spotFleetRequestIdsListIndex,
              StringUtils.fromString(cancelSpotFleetRequestsRequestSpotFleetRequestIdsListValue));
        }
        spotFleetRequestIdsListIndex++;
      }
    }

    if (cancelSpotFleetRequestsRequest.getTerminateInstances() != null) {
      request.addParameter(
          "TerminateInstances",
          StringUtils.fromBoolean(cancelSpotFleetRequestsRequest.getTerminateInstances()));
    }

    return request;
  }
  public Request<CreateDhcpOptionsRequest> marshall(
      CreateDhcpOptionsRequest createDhcpOptionsRequest) {

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

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

    com.amazonaws.internal.SdkInternalList<DhcpConfiguration> dhcpConfigurationsList =
        (com.amazonaws.internal.SdkInternalList<DhcpConfiguration>)
            createDhcpOptionsRequest.getDhcpConfigurations();
    if (!dhcpConfigurationsList.isEmpty() || !dhcpConfigurationsList.isAutoConstruct()) {
      int dhcpConfigurationsListIndex = 1;

      for (DhcpConfiguration dhcpConfigurationsListValue : dhcpConfigurationsList) {

        if (dhcpConfigurationsListValue.getKey() != null) {
          request.addParameter(
              "DhcpConfiguration." + dhcpConfigurationsListIndex + ".Key",
              StringUtils.fromString(dhcpConfigurationsListValue.getKey()));
        }

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

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

    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<ReportInstanceStatusRequest> marshall(
      ReportInstanceStatusRequest reportInstanceStatusRequest) {

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

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

    com.amazonaws.internal.SdkInternalList<String> instancesList =
        (com.amazonaws.internal.SdkInternalList<String>) reportInstanceStatusRequest.getInstances();
    if (!instancesList.isEmpty() || !instancesList.isAutoConstruct()) {
      int instancesListIndex = 1;

      for (String instancesListValue : instancesList) {
        if (instancesListValue != null) {
          request.addParameter(
              "InstanceId." + instancesListIndex, StringUtils.fromString(instancesListValue));
        }
        instancesListIndex++;
      }
    }

    if (reportInstanceStatusRequest.getStatus() != null) {
      request.addParameter(
          "Status", StringUtils.fromString(reportInstanceStatusRequest.getStatus()));
    }

    if (reportInstanceStatusRequest.getStartTime() != null) {
      request.addParameter(
          "StartTime", StringUtils.fromDate(reportInstanceStatusRequest.getStartTime()));
    }

    if (reportInstanceStatusRequest.getEndTime() != null) {
      request.addParameter(
          "EndTime", StringUtils.fromDate(reportInstanceStatusRequest.getEndTime()));
    }

    com.amazonaws.internal.SdkInternalList<String> reasonCodesList =
        (com.amazonaws.internal.SdkInternalList<String>)
            reportInstanceStatusRequest.getReasonCodes();
    if (!reasonCodesList.isEmpty() || !reasonCodesList.isAutoConstruct()) {
      int reasonCodesListIndex = 1;

      for (String reasonCodesListValue : reasonCodesList) {
        if (reasonCodesListValue != null) {
          request.addParameter(
              "ReasonCode." + reasonCodesListIndex, StringUtils.fromString(reasonCodesListValue));
        }
        reasonCodesListIndex++;
      }
    }

    if (reportInstanceStatusRequest.getDescription() != null) {
      request.addParameter(
          "Description", StringUtils.fromString(reportInstanceStatusRequest.getDescription()));
    }

    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;
  }