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

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

    try {
      jsonGenerator.writeStartObject();

      if (directoryVpcSettings.getVpcId() != null) {
        jsonGenerator.writeFieldName("VpcId").writeValue(directoryVpcSettings.getVpcId());
      }

      com.amazonaws.internal.SdkInternalList<String> subnetIdsList =
          (com.amazonaws.internal.SdkInternalList<String>) directoryVpcSettings.getSubnetIds();
      if (!subnetIdsList.isEmpty() || !subnetIdsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("SubnetIds");
        jsonGenerator.writeStartArray();
        for (String subnetIdsListValue : subnetIdsList) {
          if (subnetIdsListValue != null) {
            jsonGenerator.writeValue(subnetIdsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

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

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

    Request<CreateConditionalForwarderRequest> request =
        new DefaultRequest<CreateConditionalForwarderRequest>(
            createConditionalForwarderRequest, "AWSDirectoryService");
    request.addHeader("X-Amz-Target", "DirectoryService_20150416.CreateConditionalForwarder");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (createConditionalForwarderRequest.getDirectoryId() != null) {
        jsonGenerator
            .writeFieldName("DirectoryId")
            .writeValue(createConditionalForwarderRequest.getDirectoryId());
      }
      if (createConditionalForwarderRequest.getRemoteDomainName() != null) {
        jsonGenerator
            .writeFieldName("RemoteDomainName")
            .writeValue(createConditionalForwarderRequest.getRemoteDomainName());
      }

      com.amazonaws.internal.SdkInternalList<String> dnsIpAddrsList =
          (com.amazonaws.internal.SdkInternalList<String>)
              createConditionalForwarderRequest.getDnsIpAddrs();
      if (!dnsIpAddrsList.isEmpty() || !dnsIpAddrsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("DnsIpAddrs");
        jsonGenerator.writeStartArray();
        for (String dnsIpAddrsListValue : dnsIpAddrsList) {
          if (dnsIpAddrsListValue != null) {
            jsonGenerator.writeValue(dnsIpAddrsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();

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

    return request;
  }