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

    try {
      jsonWriter.object();

      if (instanceInformation.getInstanceId() != null) {
        jsonWriter.key("InstanceId").value(instanceInformation.getInstanceId());
      }

      if (instanceInformation.getPingStatus() != null) {
        jsonWriter.key("PingStatus").value(instanceInformation.getPingStatus());
      }

      if (instanceInformation.getLastPingDateTime() != null) {
        jsonWriter.key("LastPingDateTime").value(instanceInformation.getLastPingDateTime());
      }

      if (instanceInformation.getAgentVersion() != null) {
        jsonWriter.key("AgentVersion").value(instanceInformation.getAgentVersion());
      }

      if (instanceInformation.getIsLatestVersion() != null) {
        jsonWriter.key("IsLatestVersion").value(instanceInformation.getIsLatestVersion());
      }

      if (instanceInformation.getPlatformType() != null) {
        jsonWriter.key("PlatformType").value(instanceInformation.getPlatformType());
      }

      if (instanceInformation.getPlatformName() != null) {
        jsonWriter.key("PlatformName").value(instanceInformation.getPlatformName());
      }

      if (instanceInformation.getPlatformVersion() != null) {
        jsonWriter.key("PlatformVersion").value(instanceInformation.getPlatformVersion());
      }

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

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

    Request<CreateDocumentRequest> request =
        new DefaultRequest<CreateDocumentRequest>(
            createDocumentRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.CreateDocument");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

      if (createDocumentRequest.getContent() != null) {
        jsonWriter.key("Content").value(createDocumentRequest.getContent());
      }

      if (createDocumentRequest.getName() != null) {
        jsonWriter.key("Name").value(createDocumentRequest.getName());
      }

      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;
  }
  public Request<DescribeInstanceInformationRequest> marshall(
      DescribeInstanceInformationRequest describeInstanceInformationRequest) {

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

    Request<DescribeInstanceInformationRequest> request =
        new DefaultRequest<DescribeInstanceInformationRequest>(
            describeInstanceInformationRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.DescribeInstanceInformation");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

      com.amazonaws.internal.SdkInternalList<InstanceInformationFilter>
          instanceInformationFilterListList =
              (com.amazonaws.internal.SdkInternalList<InstanceInformationFilter>)
                  describeInstanceInformationRequest.getInstanceInformationFilterList();
      if (!instanceInformationFilterListList.isEmpty()
          || !instanceInformationFilterListList.isAutoConstruct()) {
        jsonWriter.key("InstanceInformationFilterList");
        jsonWriter.array();
        for (InstanceInformationFilter instanceInformationFilterListListValue :
            instanceInformationFilterListList) {
          if (instanceInformationFilterListListValue != null) {

            InstanceInformationFilterJsonMarshaller.getInstance()
                .marshall(instanceInformationFilterListListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      if (describeInstanceInformationRequest.getMaxResults() != null) {
        jsonWriter.key("MaxResults").value(describeInstanceInformationRequest.getMaxResults());
      }

      if (describeInstanceInformationRequest.getNextToken() != null) {
        jsonWriter.key("NextToken").value(describeInstanceInformationRequest.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;
  }