public Request<AddUploadBufferRequest> marshall(AddUploadBufferRequest addUploadBufferRequest) {
    if (addUploadBufferRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<AddUploadBufferRequest> request =
        new DefaultRequest<AddUploadBufferRequest>(addUploadBufferRequest, "AWSStorageGateway");
    String target = "StorageGateway_20130630.AddUploadBuffer";
    request.addHeader("X-Amz-Target", target);
    request.addHeader("Content-Type", "application/x-amz-json-1.1");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "";

    uriResourcePath = uriResourcePath.replaceAll("//", "/");

    if (uriResourcePath.contains("?")) {
      String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1);
      uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?"));

      for (String s : queryString.split("[;&]")) {
        String[] nameValuePair = s.split("=");
        if (nameValuePair.length == 2) {
          request.addParameter(nameValuePair[0], nameValuePair[1]);
        } else {
          request.addParameter(s, null);
        }
      }
    }

    request.setResourcePath(uriResourcePath);

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      if (addUploadBufferRequest.getGatewayARN() != null) {
        jsonWriter.key("GatewayARN").value(addUploadBufferRequest.getGatewayARN());
      }

      com.amazonaws.internal.ListWithAutoConstructFlag<String> diskIdsList =
          (com.amazonaws.internal.ListWithAutoConstructFlag<String>)
              (addUploadBufferRequest.getDiskIds());
      if (diskIdsList != null && !(diskIdsList.isAutoConstruct() && diskIdsList.isEmpty())) {

        jsonWriter.key("DiskIds");
        jsonWriter.array();

        for (String diskIdsListValue : diskIdsList) {
          if (diskIdsListValue != null) {
            jsonWriter.value(diskIdsListValue);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<DescribeCachediSCSIVolumesRequest> marshall(
      DescribeCachediSCSIVolumesRequest describeCachediSCSIVolumesRequest) {
    if (describeCachediSCSIVolumesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeCachediSCSIVolumesRequest> request =
        new DefaultRequest<DescribeCachediSCSIVolumesRequest>(
            describeCachediSCSIVolumesRequest, "AWSStorageGateway");
    String target = "StorageGateway_20120630.DescribeCachediSCSIVolumes";
    request.addHeader("X-Amz-Target", target);
    request.addHeader("Content-Type", "application/x-amz-json-1.1");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "";

    uriResourcePath = uriResourcePath.replaceAll("//", "/");

    if (uriResourcePath.contains("?")) {
      String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1);
      uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?"));

      for (String s : queryString.split("[;&]")) {
        String[] nameValuePair = s.split("=");
        if (nameValuePair.length == 2) {
          request.addParameter(nameValuePair[0], nameValuePair[1]);
        } else {
          request.addParameter(s, null);
        }
      }
    }

    request.setResourcePath(uriResourcePath);

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      java.util.List<String> volumeARNsList = describeCachediSCSIVolumesRequest.getVolumeARNs();
      if (volumeARNsList != null) {

        jsonWriter.key("VolumeARNs");
        jsonWriter.array();

        for (String volumeARNsListValue : volumeARNsList) {
          if (volumeARNsListValue != null) {
            jsonWriter.value(volumeARNsListValue);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes("UTF-8");
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }