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

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

    try {
      jsonGenerator.writeStartObject();

      if (optionStatus.getCreationDate() != null) {
        jsonGenerator.writeFieldName("CreationDate").writeValue(optionStatus.getCreationDate());
      }
      if (optionStatus.getUpdateDate() != null) {
        jsonGenerator.writeFieldName("UpdateDate").writeValue(optionStatus.getUpdateDate());
      }
      if (optionStatus.getUpdateVersion() != null) {
        jsonGenerator.writeFieldName("UpdateVersion").writeValue(optionStatus.getUpdateVersion());
      }
      if (optionStatus.getState() != null) {
        jsonGenerator.writeFieldName("State").writeValue(optionStatus.getState());
      }
      if (optionStatus.getPendingDeletion() != null) {
        jsonGenerator
            .writeFieldName("PendingDeletion")
            .writeValue(optionStatus.getPendingDeletion());
      }

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

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

    Request<AddTagsRequest> request =
        new DefaultRequest<AddTagsRequest>(addTagsRequest, "AWSElasticsearch");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/2015-01-01/tags";

    request.setResourcePath(uriResourcePath);

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

      if (addTagsRequest.getARN() != null) {
        jsonGenerator.writeFieldName("ARN").writeValue(addTagsRequest.getARN());
      }

      java.util.List<Tag> tagListList = addTagsRequest.getTagList();
      if (tagListList != null) {
        jsonGenerator.writeFieldName("TagList");
        jsonGenerator.writeStartArray();
        for (Tag tagListListValue : tagListList) {
          if (tagListListValue != null) {

            TagJsonMarshaller.getInstance().marshall(tagListListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        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 SdkJsonGenerator */
  public void marshall(DomainInfo domainInfo, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (domainInfo.getDomainName() != null) {
        jsonGenerator.writeFieldName("DomainName").writeValue(domainInfo.getDomainName());
      }

      jsonGenerator.writeEndObject();
    } 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(
      ElasticsearchDomainStatus elasticsearchDomainStatus, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (elasticsearchDomainStatus.getDomainId() != null) {
        jsonGenerator
            .writeFieldName("DomainId")
            .writeValue(elasticsearchDomainStatus.getDomainId());
      }
      if (elasticsearchDomainStatus.getDomainName() != null) {
        jsonGenerator
            .writeFieldName("DomainName")
            .writeValue(elasticsearchDomainStatus.getDomainName());
      }
      if (elasticsearchDomainStatus.getARN() != null) {
        jsonGenerator.writeFieldName("ARN").writeValue(elasticsearchDomainStatus.getARN());
      }
      if (elasticsearchDomainStatus.getCreated() != null) {
        jsonGenerator.writeFieldName("Created").writeValue(elasticsearchDomainStatus.getCreated());
      }
      if (elasticsearchDomainStatus.getDeleted() != null) {
        jsonGenerator.writeFieldName("Deleted").writeValue(elasticsearchDomainStatus.getDeleted());
      }
      if (elasticsearchDomainStatus.getEndpoint() != null) {
        jsonGenerator
            .writeFieldName("Endpoint")
            .writeValue(elasticsearchDomainStatus.getEndpoint());
      }
      if (elasticsearchDomainStatus.getProcessing() != null) {
        jsonGenerator
            .writeFieldName("Processing")
            .writeValue(elasticsearchDomainStatus.getProcessing());
      }
      if (elasticsearchDomainStatus.getElasticsearchVersion() != null) {
        jsonGenerator
            .writeFieldName("ElasticsearchVersion")
            .writeValue(elasticsearchDomainStatus.getElasticsearchVersion());
      }
      if (elasticsearchDomainStatus.getElasticsearchClusterConfig() != null) {
        jsonGenerator.writeFieldName("ElasticsearchClusterConfig");
        ElasticsearchClusterConfigJsonMarshaller.getInstance()
            .marshall(elasticsearchDomainStatus.getElasticsearchClusterConfig(), jsonGenerator);
      }
      if (elasticsearchDomainStatus.getEBSOptions() != null) {
        jsonGenerator.writeFieldName("EBSOptions");
        EBSOptionsJsonMarshaller.getInstance()
            .marshall(elasticsearchDomainStatus.getEBSOptions(), jsonGenerator);
      }
      if (elasticsearchDomainStatus.getAccessPolicies() != null) {
        jsonGenerator
            .writeFieldName("AccessPolicies")
            .writeValue(elasticsearchDomainStatus.getAccessPolicies());
      }
      if (elasticsearchDomainStatus.getSnapshotOptions() != null) {
        jsonGenerator.writeFieldName("SnapshotOptions");
        SnapshotOptionsJsonMarshaller.getInstance()
            .marshall(elasticsearchDomainStatus.getSnapshotOptions(), jsonGenerator);
      }

      java.util.Map<String, String> advancedOptionsMap =
          elasticsearchDomainStatus.getAdvancedOptions();
      if (advancedOptionsMap != null) {
        jsonGenerator.writeFieldName("AdvancedOptions");
        jsonGenerator.writeStartObject();

        for (Map.Entry<String, String> advancedOptionsMapValue : advancedOptionsMap.entrySet()) {
          if (advancedOptionsMapValue.getValue() != null) {
            jsonGenerator.writeFieldName(advancedOptionsMapValue.getKey());

            jsonGenerator.writeValue(advancedOptionsMapValue.getValue());
          }
        }
        jsonGenerator.writeEndObject();
      }

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