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

    try {
      jsonWriter.object();

      if (exportTaskStatus.getCode() != null) {
        jsonWriter.key("code").value(exportTaskStatus.getCode());
      }

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

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<PutRetentionPolicyRequest> marshall(
      PutRetentionPolicyRequest putRetentionPolicyRequest) {
    if (putRetentionPolicyRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<PutRetentionPolicyRequest> request =
        new DefaultRequest<PutRetentionPolicyRequest>(putRetentionPolicyRequest, "AWSLogs");
    String target = "Logs_20140328.PutRetentionPolicy";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

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

      jsonWriter.object();

      if (putRetentionPolicyRequest.getLogGroupName() != null) {
        jsonWriter.key("logGroupName").value(putRetentionPolicyRequest.getLogGroupName());
      }
      if (putRetentionPolicyRequest.getRetentionInDays() != null) {
        jsonWriter.key("retentionInDays").value(putRetentionPolicyRequest.getRetentionInDays());
      }

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