/** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(DocumentParameter documentParameter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (documentParameter.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(documentParameter.getName());
      }
      if (documentParameter.getType() != null) {
        jsonGenerator.writeFieldName("Type").writeValue(documentParameter.getType());
      }
      if (documentParameter.getDescription() != null) {
        jsonGenerator.writeFieldName("Description").writeValue(documentParameter.getDescription());
      }
      if (documentParameter.getDefaultValue() != null) {
        jsonGenerator
            .writeFieldName("DefaultValue")
            .writeValue(documentParameter.getDefaultValue());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      MaintenanceWindowFilter maintenanceWindowFilter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (maintenanceWindowFilter.getKey() != null) {
        jsonGenerator.writeFieldName("Key").writeValue(maintenanceWindowFilter.getKey());
      }

      com.amazonaws.internal.SdkInternalList<String> valuesList =
          (com.amazonaws.internal.SdkInternalList<String>) maintenanceWindowFilter.getValues();
      if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Values");
        jsonGenerator.writeStartArray();
        for (String valuesListValue : valuesList) {
          if (valuesListValue != null) {
            jsonGenerator.writeValue(valuesListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<ListDocumentsRequest> marshall(ListDocumentsRequest listDocumentsRequest) {

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

    Request<ListDocumentsRequest> request =
        new DefaultRequest<ListDocumentsRequest>(
            listDocumentsRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.ListDocuments");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<DocumentFilter> documentFilterListList =
          (com.amazonaws.internal.SdkInternalList<DocumentFilter>)
              listDocumentsRequest.getDocumentFilterList();
      if (!documentFilterListList.isEmpty() || !documentFilterListList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("DocumentFilterList");
        jsonGenerator.writeStartArray();
        for (DocumentFilter documentFilterListListValue : documentFilterListList) {
          if (documentFilterListListValue != null) {

            DocumentFilterJsonMarshaller.getInstance()
                .marshall(documentFilterListListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (listDocumentsRequest.getMaxResults() != null) {
        jsonGenerator.writeFieldName("MaxResults").writeValue(listDocumentsRequest.getMaxResults());
      }
      if (listDocumentsRequest.getNextToken() != null) {
        jsonGenerator.writeFieldName("NextToken").writeValue(listDocumentsRequest.getNextToken());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<UpdateAssociationStatusRequest> marshall(
      UpdateAssociationStatusRequest updateAssociationStatusRequest) {

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

    Request<UpdateAssociationStatusRequest> request =
        new DefaultRequest<UpdateAssociationStatusRequest>(
            updateAssociationStatusRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.UpdateAssociationStatus");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

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

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

      if (updateAssociationStatusRequest.getAssociationStatus() != null) {
        jsonWriter.key("AssociationStatus");
        AssociationStatusJsonMarshaller.getInstance()
            .marshall(updateAssociationStatusRequest.getAssociationStatus(), jsonWriter);
      }

      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<DescribeAssociationRequest> marshall(
      DescribeAssociationRequest describeAssociationRequest) {

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

    Request<DescribeAssociationRequest> request =
        new DefaultRequest<DescribeAssociationRequest>(
            describeAssociationRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.DescribeAssociation");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      if (describeAssociationRequest.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(describeAssociationRequest.getName());
      }
      if (describeAssociationRequest.getInstanceId() != null) {
        jsonGenerator
            .writeFieldName("InstanceId")
            .writeValue(describeAssociationRequest.getInstanceId());
      }
      if (describeAssociationRequest.getAssociationId() != null) {
        jsonGenerator
            .writeFieldName("AssociationId")
            .writeValue(describeAssociationRequest.getAssociationId());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  /** 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);
    }
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      PatchComplianceData patchComplianceData, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (patchComplianceData.getTitle() != null) {
        jsonGenerator.writeFieldName("Title").writeValue(patchComplianceData.getTitle());
      }
      if (patchComplianceData.getKBId() != null) {
        jsonGenerator.writeFieldName("KBId").writeValue(patchComplianceData.getKBId());
      }
      if (patchComplianceData.getClassification() != null) {
        jsonGenerator
            .writeFieldName("Classification")
            .writeValue(patchComplianceData.getClassification());
      }
      if (patchComplianceData.getSeverity() != null) {
        jsonGenerator.writeFieldName("Severity").writeValue(patchComplianceData.getSeverity());
      }
      if (patchComplianceData.getState() != null) {
        jsonGenerator.writeFieldName("State").writeValue(patchComplianceData.getState());
      }
      if (patchComplianceData.getInstalledTime() != null) {
        jsonGenerator
            .writeFieldName("InstalledTime")
            .writeValue(patchComplianceData.getInstalledTime());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(LoggingInfo loggingInfo, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (loggingInfo.getS3BucketName() != null) {
        jsonGenerator.writeFieldName("S3BucketName").writeValue(loggingInfo.getS3BucketName());
      }
      if (loggingInfo.getS3KeyPrefix() != null) {
        jsonGenerator.writeFieldName("S3KeyPrefix").writeValue(loggingInfo.getS3KeyPrefix());
      }
      if (loggingInfo.getS3Region() != null) {
        jsonGenerator.writeFieldName("S3Region").writeValue(loggingInfo.getS3Region());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  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;
  }