public Request<ListSamplesRequest> marshall(ListSamplesRequest listSamplesRequest) {

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

    Request<ListSamplesRequest> request =
        new DefaultRequest<ListSamplesRequest>(listSamplesRequest, "AWSDeviceFarm");
    request.addHeader("X-Amz-Target", "DeviceFarm_20150623.ListSamples");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

      if (listSamplesRequest.getArn() != null) {
        jsonWriter.key("arn").value(listSamplesRequest.getArn());
      }

      if (listSamplesRequest.getNextToken() != null) {
        jsonWriter.key("nextToken").value(listSamplesRequest.getNextToken());
      }

      jsonWriter.endObject();

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

    return request;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(Upload upload, JSONWriter jsonWriter) {
    if (upload == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (upload.getArn() != null) {
        jsonWriter.key("arn").value(upload.getArn());
      }

      if (upload.getName() != null) {
        jsonWriter.key("name").value(upload.getName());
      }

      if (upload.getCreated() != null) {
        jsonWriter.key("created").value(upload.getCreated());
      }

      if (upload.getType() != null) {
        jsonWriter.key("type").value(upload.getType());
      }

      if (upload.getStatus() != null) {
        jsonWriter.key("status").value(upload.getStatus());
      }

      if (upload.getUrl() != null) {
        jsonWriter.key("url").value(upload.getUrl());
      }

      if (upload.getMetadata() != null) {
        jsonWriter.key("metadata").value(upload.getMetadata());
      }

      if (upload.getContentType() != null) {
        jsonWriter.key("contentType").value(upload.getContentType());
      }

      if (upload.getMessage() != null) {
        jsonWriter.key("message").value(upload.getMessage());
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }