@Test
 public void unclosedArray_AutoClosesOnClose() throws IOException {
   jsonGenerator.writeStartArray();
   jsonGenerator.writeValue("valOne");
   jsonGenerator.writeValue("valTwo");
   jsonGenerator.writeValue("valThree");
   JsonNode node = toJsonNode();
   assertTrue(node.isArray());
   assertEquals(3, node.size());
 }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(AccountSettings accountSettings, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (accountSettings.getAwsAccountNumber() != null) {
        jsonGenerator
            .writeFieldName("awsAccountNumber")
            .writeValue(accountSettings.getAwsAccountNumber());
      }

      java.util.Map<String, Integer> unmeteredDevicesMap = accountSettings.getUnmeteredDevices();
      if (unmeteredDevicesMap != null) {
        jsonGenerator.writeFieldName("unmeteredDevices");
        jsonGenerator.writeStartObject();

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

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

      java.util.Map<String, Integer> unmeteredRemoteAccessDevicesMap =
          accountSettings.getUnmeteredRemoteAccessDevices();
      if (unmeteredRemoteAccessDevicesMap != null) {
        jsonGenerator.writeFieldName("unmeteredRemoteAccessDevices");
        jsonGenerator.writeStartObject();

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

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

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
 @Test
 public void stringArray() throws IOException {
   jsonGenerator.writeStartArray();
   jsonGenerator.writeValue("valOne");
   jsonGenerator.writeValue("valTwo");
   jsonGenerator.writeValue("valThree");
   jsonGenerator.writeEndArray();
   JsonNode node = toJsonNode();
   assertTrue(node.isArray());
   assertEquals("valOne", node.get(0).textValue());
   assertEquals("valTwo", node.get(1).textValue());
   assertEquals("valThree", node.get(2).textValue());
 }
  /** 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);
    }
  }
  /** 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);
    }
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      VaultNotificationConfig vaultNotificationConfig, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (vaultNotificationConfig.getSNSTopic() != null) {
        jsonGenerator.writeFieldName("SNSTopic").writeValue(vaultNotificationConfig.getSNSTopic());
      }

      java.util.List<String> eventsList = vaultNotificationConfig.getEvents();
      if (eventsList != null) {
        jsonGenerator.writeFieldName("Events");
        jsonGenerator.writeStartArray();
        for (String eventsListValue : eventsList) {
          if (eventsListValue != null) {
            jsonGenerator.writeValue(eventsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      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(
      AutoScalingThresholds autoScalingThresholds, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (autoScalingThresholds.getInstanceCount() != null) {
        jsonGenerator
            .writeFieldName("InstanceCount")
            .writeValue(autoScalingThresholds.getInstanceCount());
      }
      if (autoScalingThresholds.getThresholdsWaitTime() != null) {
        jsonGenerator
            .writeFieldName("ThresholdsWaitTime")
            .writeValue(autoScalingThresholds.getThresholdsWaitTime());
      }
      if (autoScalingThresholds.getIgnoreMetricsTime() != null) {
        jsonGenerator
            .writeFieldName("IgnoreMetricsTime")
            .writeValue(autoScalingThresholds.getIgnoreMetricsTime());
      }
      if (autoScalingThresholds.getCpuThreshold() != null) {
        jsonGenerator
            .writeFieldName("CpuThreshold")
            .writeValue(autoScalingThresholds.getCpuThreshold());
      }
      if (autoScalingThresholds.getMemoryThreshold() != null) {
        jsonGenerator
            .writeFieldName("MemoryThreshold")
            .writeValue(autoScalingThresholds.getMemoryThreshold());
      }
      if (autoScalingThresholds.getLoadThreshold() != null) {
        jsonGenerator
            .writeFieldName("LoadThreshold")
            .writeValue(autoScalingThresholds.getLoadThreshold());
      }

      com.amazonaws.internal.SdkInternalList<String> alarmsList =
          (com.amazonaws.internal.SdkInternalList<String>) autoScalingThresholds.getAlarms();
      if (!alarmsList.isEmpty() || !alarmsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Alarms");
        jsonGenerator.writeStartArray();
        for (String alarmsListValue : alarmsList) {
          if (alarmsListValue != null) {
            jsonGenerator.writeValue(alarmsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("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;
  }
  public Request<ListClustersRequest> marshall(ListClustersRequest listClustersRequest) {

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

    Request<ListClustersRequest> request =
        new DefaultRequest<ListClustersRequest>(listClustersRequest, "AmazonElasticMapReduce");
    request.addHeader("X-Amz-Target", "ElasticMapReduce.ListClusters");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (listClustersRequest.getCreatedAfter() != null) {
        jsonGenerator
            .writeFieldName("CreatedAfter")
            .writeValue(listClustersRequest.getCreatedAfter());
      }
      if (listClustersRequest.getCreatedBefore() != null) {
        jsonGenerator
            .writeFieldName("CreatedBefore")
            .writeValue(listClustersRequest.getCreatedBefore());
      }

      com.amazonaws.internal.SdkInternalList<String> clusterStatesList =
          (com.amazonaws.internal.SdkInternalList<String>) listClustersRequest.getClusterStates();
      if (!clusterStatesList.isEmpty() || !clusterStatesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("ClusterStates");
        jsonGenerator.writeStartArray();
        for (String clusterStatesListValue : clusterStatesList) {
          if (clusterStatesListValue != null) {
            jsonGenerator.writeValue(clusterStatesListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (listClustersRequest.getMarker() != null) {
        jsonGenerator.writeFieldName("Marker").writeValue(listClustersRequest.getMarker());
      }

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

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

    Request<DeleteTagsRequest> request =
        new DefaultRequest<DeleteTagsRequest>(deleteTagsRequest, "AWSApplicationDiscovery");
    request.addHeader("X-Amz-Target", "AWSPoseidonService_V2015_11_01.DeleteTags");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      java.util.List<String> configurationIdsList = deleteTagsRequest.getConfigurationIds();
      if (configurationIdsList != null) {
        jsonGenerator.writeFieldName("configurationIds");
        jsonGenerator.writeStartArray();
        for (String configurationIdsListValue : configurationIdsList) {
          if (configurationIdsListValue != null) {
            jsonGenerator.writeValue(configurationIdsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      java.util.List<Tag> tagsList = deleteTagsRequest.getTags();
      if (tagsList != null) {
        jsonGenerator.writeFieldName("tags");
        jsonGenerator.writeStartArray();
        for (Tag tagsListValue : tagsList) {
          if (tagsListValue != null) {

            TagJsonMarshaller.getInstance().marshall(tagsListValue, jsonGenerator);
          }
        }
        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;
  }
  public Request<DescribeRaidArraysRequest> marshall(
      DescribeRaidArraysRequest describeRaidArraysRequest) {

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

    Request<DescribeRaidArraysRequest> request =
        new DefaultRequest<DescribeRaidArraysRequest>(describeRaidArraysRequest, "AWSOpsWorks");
    request.addHeader("X-Amz-Target", "OpsWorks_20130218.DescribeRaidArrays");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (describeRaidArraysRequest.getInstanceId() != null) {
        jsonGenerator
            .writeFieldName("InstanceId")
            .writeValue(describeRaidArraysRequest.getInstanceId());
      }
      if (describeRaidArraysRequest.getStackId() != null) {
        jsonGenerator.writeFieldName("StackId").writeValue(describeRaidArraysRequest.getStackId());
      }

      com.amazonaws.internal.SdkInternalList<String> raidArrayIdsList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeRaidArraysRequest.getRaidArrayIds();
      if (!raidArrayIdsList.isEmpty() || !raidArrayIdsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("RaidArrayIds");
        jsonGenerator.writeStartArray();
        for (String raidArrayIdsListValue : raidArrayIdsList) {
          if (raidArrayIdsListValue != null) {
            jsonGenerator.writeValue(raidArrayIdsListValue);
          }
        }
        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", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<CreatePlayerSessionsRequest> marshall(
      CreatePlayerSessionsRequest createPlayerSessionsRequest) {

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

    Request<CreatePlayerSessionsRequest> request =
        new DefaultRequest<CreatePlayerSessionsRequest>(
            createPlayerSessionsRequest, "AmazonGameLift");
    request.addHeader("X-Amz-Target", "GameLift.CreatePlayerSessions");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (createPlayerSessionsRequest.getGameSessionId() != null) {
        jsonGenerator
            .writeFieldName("GameSessionId")
            .writeValue(createPlayerSessionsRequest.getGameSessionId());
      }

      java.util.List<String> playerIdsList = createPlayerSessionsRequest.getPlayerIds();
      if (playerIdsList != null) {
        jsonGenerator.writeFieldName("PlayerIds");
        jsonGenerator.writeStartArray();
        for (String playerIdsListValue : playerIdsList) {
          if (playerIdsListValue != null) {
            jsonGenerator.writeValue(playerIdsListValue);
          }
        }
        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", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<DescribeRulesPackagesRequest> marshall(
      DescribeRulesPackagesRequest describeRulesPackagesRequest) {

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

    Request<DescribeRulesPackagesRequest> request =
        new DefaultRequest<DescribeRulesPackagesRequest>(
            describeRulesPackagesRequest, "AmazonInspector");
    request.addHeader("X-Amz-Target", "InspectorService.DescribeRulesPackages");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      java.util.List<String> rulesPackageArnsList =
          describeRulesPackagesRequest.getRulesPackageArns();
      if (rulesPackageArnsList != null) {
        jsonGenerator.writeFieldName("rulesPackageArns");
        jsonGenerator.writeStartArray();
        for (String rulesPackageArnsListValue : rulesPackageArnsList) {
          if (rulesPackageArnsListValue != null) {
            jsonGenerator.writeValue(rulesPackageArnsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (describeRulesPackagesRequest.getLocale() != null) {
        jsonGenerator.writeFieldName("locale").writeValue(describeRulesPackagesRequest.getLocale());
      }

      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<DescribeConfigurationRecordersRequest> marshall(
      DescribeConfigurationRecordersRequest describeConfigurationRecordersRequest) {

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

    Request<DescribeConfigurationRecordersRequest> request =
        new DefaultRequest<DescribeConfigurationRecordersRequest>(
            describeConfigurationRecordersRequest, "AmazonConfig");
    request.addHeader("X-Amz-Target", "StarlingDoveService.DescribeConfigurationRecorders");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<String> configurationRecorderNamesList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeConfigurationRecordersRequest.getConfigurationRecorderNames();
      if (!configurationRecorderNamesList.isEmpty()
          || !configurationRecorderNamesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("ConfigurationRecorderNames");
        jsonGenerator.writeStartArray();
        for (String configurationRecorderNamesListValue : configurationRecorderNamesList) {
          if (configurationRecorderNamesListValue != null) {
            jsonGenerator.writeValue(configurationRecorderNamesListValue);
          }
        }
        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", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      HadoopJarStepConfig hadoopJarStepConfig, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<KeyValue> propertiesList =
          (com.amazonaws.internal.SdkInternalList<KeyValue>) hadoopJarStepConfig.getProperties();
      if (!propertiesList.isEmpty() || !propertiesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Properties");
        jsonGenerator.writeStartArray();
        for (KeyValue propertiesListValue : propertiesList) {
          if (propertiesListValue != null) {

            KeyValueJsonMarshaller.getInstance().marshall(propertiesListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (hadoopJarStepConfig.getJar() != null) {
        jsonGenerator.writeFieldName("Jar").writeValue(hadoopJarStepConfig.getJar());
      }
      if (hadoopJarStepConfig.getMainClass() != null) {
        jsonGenerator.writeFieldName("MainClass").writeValue(hadoopJarStepConfig.getMainClass());
      }

      com.amazonaws.internal.SdkInternalList<String> argsList =
          (com.amazonaws.internal.SdkInternalList<String>) hadoopJarStepConfig.getArgs();
      if (!argsList.isEmpty() || !argsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Args");
        jsonGenerator.writeStartArray();
        for (String argsListValue : argsList) {
          if (argsListValue != null) {
            jsonGenerator.writeValue(argsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

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

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

    Request<PutTraceSegmentsRequest> request =
        new DefaultRequest<PutTraceSegmentsRequest>(putTraceSegmentsRequest, "AWSXRay");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/TraceSegments";

    request.setResourcePath(uriResourcePath);

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

      java.util.List<String> traceSegmentDocumentsList =
          putTraceSegmentsRequest.getTraceSegmentDocuments();
      if (traceSegmentDocumentsList != null) {
        jsonGenerator.writeFieldName("TraceSegmentDocuments");
        jsonGenerator.writeStartArray();
        for (String traceSegmentDocumentsListValue : traceSegmentDocumentsList) {
          if (traceSegmentDocumentsListValue != null) {
            jsonGenerator.writeValue(traceSegmentDocumentsListValue);
          }
        }
        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(ScheduleRunTest scheduleRunTest, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (scheduleRunTest.getType() != null) {
        jsonGenerator.writeFieldName("type").writeValue(scheduleRunTest.getType());
      }
      if (scheduleRunTest.getTestPackageArn() != null) {
        jsonGenerator
            .writeFieldName("testPackageArn")
            .writeValue(scheduleRunTest.getTestPackageArn());
      }
      if (scheduleRunTest.getFilter() != null) {
        jsonGenerator.writeFieldName("filter").writeValue(scheduleRunTest.getFilter());
      }

      java.util.Map<String, String> parametersMap = scheduleRunTest.getParameters();
      if (parametersMap != null) {
        jsonGenerator.writeFieldName("parameters");
        jsonGenerator.writeStartObject();

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

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

      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(
      IdentityDescription identityDescription, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (identityDescription.getIdentityId() != null) {
        jsonGenerator.writeFieldName("IdentityId").writeValue(identityDescription.getIdentityId());
      }

      java.util.List<String> loginsList = identityDescription.getLogins();
      if (loginsList != null) {
        jsonGenerator.writeFieldName("Logins");
        jsonGenerator.writeStartArray();
        for (String loginsListValue : loginsList) {
          if (loginsListValue != null) {
            jsonGenerator.writeValue(loginsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (identityDescription.getCreationDate() != null) {
        jsonGenerator
            .writeFieldName("CreationDate")
            .writeValue(identityDescription.getCreationDate());
      }
      if (identityDescription.getLastModifiedDate() != null) {
        jsonGenerator
            .writeFieldName("LastModifiedDate")
            .writeValue(identityDescription.getLastModifiedDate());
      }

      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(EventDetails eventDetails, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (eventDetails.getEvent() != null) {
        jsonGenerator.writeFieldName("event");
        EventJsonMarshaller.getInstance().marshall(eventDetails.getEvent(), jsonGenerator);
      }
      if (eventDetails.getEventDescription() != null) {
        jsonGenerator.writeFieldName("eventDescription");
        EventDescriptionJsonMarshaller.getInstance()
            .marshall(eventDetails.getEventDescription(), jsonGenerator);
      }

      java.util.Map<String, String> eventMetadataMap = eventDetails.getEventMetadata();
      if (eventMetadataMap != null) {
        jsonGenerator.writeFieldName("eventMetadata");
        jsonGenerator.writeStartObject();

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

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

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

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

    Request<RemoveTagsFromOnPremisesInstancesRequest> request =
        new DefaultRequest<RemoveTagsFromOnPremisesInstancesRequest>(
            removeTagsFromOnPremisesInstancesRequest, "AmazonCodeDeploy");
    request.addHeader("X-Amz-Target", "CodeDeploy_20141006.RemoveTagsFromOnPremisesInstances");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<Tag> tagsList =
          (com.amazonaws.internal.SdkInternalList<Tag>)
              removeTagsFromOnPremisesInstancesRequest.getTags();
      if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("tags");
        jsonGenerator.writeStartArray();
        for (Tag tagsListValue : tagsList) {
          if (tagsListValue != null) {

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

      com.amazonaws.internal.SdkInternalList<String> instanceNamesList =
          (com.amazonaws.internal.SdkInternalList<String>)
              removeTagsFromOnPremisesInstancesRequest.getInstanceNames();
      if (!instanceNamesList.isEmpty() || !instanceNamesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("instanceNames");
        jsonGenerator.writeStartArray();
        for (String instanceNamesListValue : instanceNamesList) {
          if (instanceNamesListValue != null) {
            jsonGenerator.writeValue(instanceNamesListValue);
          }
        }
        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;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(AssessmentRun assessmentRun, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (assessmentRun.getArn() != null) {
        jsonGenerator.writeFieldName("arn").writeValue(assessmentRun.getArn());
      }
      if (assessmentRun.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(assessmentRun.getName());
      }
      if (assessmentRun.getAssessmentTemplateArn() != null) {
        jsonGenerator
            .writeFieldName("assessmentTemplateArn")
            .writeValue(assessmentRun.getAssessmentTemplateArn());
      }
      if (assessmentRun.getState() != null) {
        jsonGenerator.writeFieldName("state").writeValue(assessmentRun.getState());
      }
      if (assessmentRun.getDurationInSeconds() != null) {
        jsonGenerator
            .writeFieldName("durationInSeconds")
            .writeValue(assessmentRun.getDurationInSeconds());
      }

      java.util.List<String> rulesPackageArnsList = assessmentRun.getRulesPackageArns();
      if (rulesPackageArnsList != null) {
        jsonGenerator.writeFieldName("rulesPackageArns");
        jsonGenerator.writeStartArray();
        for (String rulesPackageArnsListValue : rulesPackageArnsList) {
          if (rulesPackageArnsListValue != null) {
            jsonGenerator.writeValue(rulesPackageArnsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      java.util.List<Attribute> userAttributesForFindingsList =
          assessmentRun.getUserAttributesForFindings();
      if (userAttributesForFindingsList != null) {
        jsonGenerator.writeFieldName("userAttributesForFindings");
        jsonGenerator.writeStartArray();
        for (Attribute userAttributesForFindingsListValue : userAttributesForFindingsList) {
          if (userAttributesForFindingsListValue != null) {

            AttributeJsonMarshaller.getInstance()
                .marshall(userAttributesForFindingsListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (assessmentRun.getCreatedAt() != null) {
        jsonGenerator.writeFieldName("createdAt").writeValue(assessmentRun.getCreatedAt());
      }
      if (assessmentRun.getStartedAt() != null) {
        jsonGenerator.writeFieldName("startedAt").writeValue(assessmentRun.getStartedAt());
      }
      if (assessmentRun.getCompletedAt() != null) {
        jsonGenerator.writeFieldName("completedAt").writeValue(assessmentRun.getCompletedAt());
      }
      if (assessmentRun.getStateChangedAt() != null) {
        jsonGenerator
            .writeFieldName("stateChangedAt")
            .writeValue(assessmentRun.getStateChangedAt());
      }
      if (assessmentRun.getDataCollected() != null) {
        jsonGenerator.writeFieldName("dataCollected").writeValue(assessmentRun.getDataCollected());
      }

      java.util.List<AssessmentRunStateChange> stateChangesList = assessmentRun.getStateChanges();
      if (stateChangesList != null) {
        jsonGenerator.writeFieldName("stateChanges");
        jsonGenerator.writeStartArray();
        for (AssessmentRunStateChange stateChangesListValue : stateChangesList) {
          if (stateChangesListValue != null) {

            AssessmentRunStateChangeJsonMarshaller.getInstance()
                .marshall(stateChangesListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }

      java.util.List<AssessmentRunNotification> notificationsList =
          assessmentRun.getNotifications();
      if (notificationsList != null) {
        jsonGenerator.writeFieldName("notifications");
        jsonGenerator.writeStartArray();
        for (AssessmentRunNotification notificationsListValue : notificationsList) {
          if (notificationsListValue != null) {

            AssessmentRunNotificationJsonMarshaller.getInstance()
                .marshall(notificationsListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }

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

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

    Request<RequestCertificateRequest> request =
        new DefaultRequest<RequestCertificateRequest>(
            requestCertificateRequest, "AWSCertificateManager");
    request.addHeader("X-Amz-Target", "CertificateManager.RequestCertificate");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

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

      java.util.List<String> subjectAlternativeNamesList =
          requestCertificateRequest.getSubjectAlternativeNames();
      if (subjectAlternativeNamesList != null) {
        jsonGenerator.writeFieldName("SubjectAlternativeNames");
        jsonGenerator.writeStartArray();
        for (String subjectAlternativeNamesListValue : subjectAlternativeNamesList) {
          if (subjectAlternativeNamesListValue != null) {
            jsonGenerator.writeValue(subjectAlternativeNamesListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (requestCertificateRequest.getIdempotencyToken() != null) {
        jsonGenerator
            .writeFieldName("IdempotencyToken")
            .writeValue(requestCertificateRequest.getIdempotencyToken());
      }

      java.util.List<DomainValidationOption> domainValidationOptionsList =
          requestCertificateRequest.getDomainValidationOptions();
      if (domainValidationOptionsList != null) {
        jsonGenerator.writeFieldName("DomainValidationOptions");
        jsonGenerator.writeStartArray();
        for (DomainValidationOption domainValidationOptionsListValue :
            domainValidationOptionsList) {
          if (domainValidationOptionsListValue != null) {

            DomainValidationOptionJsonMarshaller.getInstance()
                .marshall(domainValidationOptionsListValue, jsonGenerator);
          }
        }
        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", 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(
      AssessmentRunFilter assessmentRunFilter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (assessmentRunFilter.getNamePattern() != null) {
        jsonGenerator
            .writeFieldName("namePattern")
            .writeValue(assessmentRunFilter.getNamePattern());
      }

      java.util.List<String> statesList = assessmentRunFilter.getStates();
      if (statesList != null) {
        jsonGenerator.writeFieldName("states");
        jsonGenerator.writeStartArray();
        for (String statesListValue : statesList) {
          if (statesListValue != null) {
            jsonGenerator.writeValue(statesListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (assessmentRunFilter.getDurationRange() != null) {
        jsonGenerator.writeFieldName("durationRange");
        DurationRangeJsonMarshaller.getInstance()
            .marshall(assessmentRunFilter.getDurationRange(), jsonGenerator);
      }

      java.util.List<String> rulesPackageArnsList = assessmentRunFilter.getRulesPackageArns();
      if (rulesPackageArnsList != null) {
        jsonGenerator.writeFieldName("rulesPackageArns");
        jsonGenerator.writeStartArray();
        for (String rulesPackageArnsListValue : rulesPackageArnsList) {
          if (rulesPackageArnsListValue != null) {
            jsonGenerator.writeValue(rulesPackageArnsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (assessmentRunFilter.getStartTimeRange() != null) {
        jsonGenerator.writeFieldName("startTimeRange");
        TimestampRangeJsonMarshaller.getInstance()
            .marshall(assessmentRunFilter.getStartTimeRange(), jsonGenerator);
      }
      if (assessmentRunFilter.getCompletionTimeRange() != null) {
        jsonGenerator.writeFieldName("completionTimeRange");
        TimestampRangeJsonMarshaller.getInstance()
            .marshall(assessmentRunFilter.getCompletionTimeRange(), jsonGenerator);
      }
      if (assessmentRunFilter.getStateChangeTimeRange() != null) {
        jsonGenerator.writeFieldName("stateChangeTimeRange");
        TimestampRangeJsonMarshaller.getInstance()
            .marshall(assessmentRunFilter.getStateChangeTimeRange(), jsonGenerator);
      }

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

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

    Request<AdminInitiateAuthRequest> request =
        new DefaultRequest<AdminInitiateAuthRequest>(
            adminInitiateAuthRequest, "AWSCognitoIdentityProvider");
    request.addHeader("X-Amz-Target", "AWSCognitoIdentityProviderService.AdminInitiateAuth");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (adminInitiateAuthRequest.getUserPoolId() != null) {
        jsonGenerator
            .writeFieldName("UserPoolId")
            .writeValue(adminInitiateAuthRequest.getUserPoolId());
      }
      if (adminInitiateAuthRequest.getClientId() != null) {
        jsonGenerator.writeFieldName("ClientId").writeValue(adminInitiateAuthRequest.getClientId());
      }
      if (adminInitiateAuthRequest.getAuthFlow() != null) {
        jsonGenerator.writeFieldName("AuthFlow").writeValue(adminInitiateAuthRequest.getAuthFlow());
      }

      java.util.Map<String, String> authParametersMap =
          adminInitiateAuthRequest.getAuthParameters();
      if (authParametersMap != null) {
        jsonGenerator.writeFieldName("AuthParameters");
        jsonGenerator.writeStartObject();

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

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

      java.util.Map<String, String> clientMetadataMap =
          adminInitiateAuthRequest.getClientMetadata();
      if (clientMetadataMap != null) {
        jsonGenerator.writeFieldName("ClientMetadata");
        jsonGenerator.writeStartObject();

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

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

      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 AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<DescribeScalingPoliciesRequest> marshall(
      DescribeScalingPoliciesRequest describeScalingPoliciesRequest) {

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

    Request<DescribeScalingPoliciesRequest> request =
        new DefaultRequest<DescribeScalingPoliciesRequest>(
            describeScalingPoliciesRequest, "AWSApplicationAutoScaling");
    request.addHeader("X-Amz-Target", "AnyScaleFrontendService.DescribeScalingPolicies");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      java.util.List<String> policyNamesList = describeScalingPoliciesRequest.getPolicyNames();
      if (policyNamesList != null) {
        jsonGenerator.writeFieldName("PolicyNames");
        jsonGenerator.writeStartArray();
        for (String policyNamesListValue : policyNamesList) {
          if (policyNamesListValue != null) {
            jsonGenerator.writeValue(policyNamesListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (describeScalingPoliciesRequest.getServiceNamespace() != null) {
        jsonGenerator
            .writeFieldName("ServiceNamespace")
            .writeValue(describeScalingPoliciesRequest.getServiceNamespace());
      }
      if (describeScalingPoliciesRequest.getResourceId() != null) {
        jsonGenerator
            .writeFieldName("ResourceId")
            .writeValue(describeScalingPoliciesRequest.getResourceId());
      }
      if (describeScalingPoliciesRequest.getScalableDimension() != null) {
        jsonGenerator
            .writeFieldName("ScalableDimension")
            .writeValue(describeScalingPoliciesRequest.getScalableDimension());
      }
      if (describeScalingPoliciesRequest.getMaxResults() != null) {
        jsonGenerator
            .writeFieldName("MaxResults")
            .writeValue(describeScalingPoliciesRequest.getMaxResults());
      }
      if (describeScalingPoliciesRequest.getNextToken() != null) {
        jsonGenerator
            .writeFieldName("NextToken")
            .writeValue(describeScalingPoliciesRequest.getNextToken());
      }

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

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

    Request<UnlinkIdentityRequest> request =
        new DefaultRequest<UnlinkIdentityRequest>(unlinkIdentityRequest, "AmazonCognitoIdentity");
    request.addHeader("X-Amz-Target", "AWSCognitoIdentityService.UnlinkIdentity");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (unlinkIdentityRequest.getIdentityId() != null) {
        jsonGenerator
            .writeFieldName("IdentityId")
            .writeValue(unlinkIdentityRequest.getIdentityId());
      }

      java.util.Map<String, String> loginsMap = unlinkIdentityRequest.getLogins();
      if (loginsMap != null) {
        jsonGenerator.writeFieldName("Logins");
        jsonGenerator.writeStartObject();

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

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

      java.util.List<String> loginsToRemoveList = unlinkIdentityRequest.getLoginsToRemove();
      if (loginsToRemoveList != null) {
        jsonGenerator.writeFieldName("LoginsToRemove");
        jsonGenerator.writeStartArray();
        for (String loginsToRemoveListValue : loginsToRemoveList) {
          if (loginsToRemoveListValue != null) {
            jsonGenerator.writeValue(loginsToRemoveListValue);
          }
        }
        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", 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(FleetAttributes fleetAttributes, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (fleetAttributes.getFleetId() != null) {
        jsonGenerator.writeFieldName("FleetId").writeValue(fleetAttributes.getFleetId());
      }
      if (fleetAttributes.getDescription() != null) {
        jsonGenerator.writeFieldName("Description").writeValue(fleetAttributes.getDescription());
      }
      if (fleetAttributes.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(fleetAttributes.getName());
      }
      if (fleetAttributes.getCreationTime() != null) {
        jsonGenerator.writeFieldName("CreationTime").writeValue(fleetAttributes.getCreationTime());
      }
      if (fleetAttributes.getTerminationTime() != null) {
        jsonGenerator
            .writeFieldName("TerminationTime")
            .writeValue(fleetAttributes.getTerminationTime());
      }
      if (fleetAttributes.getStatus() != null) {
        jsonGenerator.writeFieldName("Status").writeValue(fleetAttributes.getStatus());
      }
      if (fleetAttributes.getBuildId() != null) {
        jsonGenerator.writeFieldName("BuildId").writeValue(fleetAttributes.getBuildId());
      }
      if (fleetAttributes.getServerLaunchPath() != null) {
        jsonGenerator
            .writeFieldName("ServerLaunchPath")
            .writeValue(fleetAttributes.getServerLaunchPath());
      }
      if (fleetAttributes.getServerLaunchParameters() != null) {
        jsonGenerator
            .writeFieldName("ServerLaunchParameters")
            .writeValue(fleetAttributes.getServerLaunchParameters());
      }

      java.util.List<String> logPathsList = fleetAttributes.getLogPaths();
      if (logPathsList != null) {
        jsonGenerator.writeFieldName("LogPaths");
        jsonGenerator.writeStartArray();
        for (String logPathsListValue : logPathsList) {
          if (logPathsListValue != null) {
            jsonGenerator.writeValue(logPathsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (fleetAttributes.getNewGameSessionProtectionPolicy() != null) {
        jsonGenerator
            .writeFieldName("NewGameSessionProtectionPolicy")
            .writeValue(fleetAttributes.getNewGameSessionProtectionPolicy());
      }
      if (fleetAttributes.getOperatingSystem() != null) {
        jsonGenerator
            .writeFieldName("OperatingSystem")
            .writeValue(fleetAttributes.getOperatingSystem());
      }
      if (fleetAttributes.getResourceCreationLimitPolicy() != null) {
        jsonGenerator.writeFieldName("ResourceCreationLimitPolicy");
        ResourceCreationLimitPolicyJsonMarshaller.getInstance()
            .marshall(fleetAttributes.getResourceCreationLimitPolicy(), jsonGenerator);
      }

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

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

    Request<CreateAssessmentTemplateRequest> request =
        new DefaultRequest<CreateAssessmentTemplateRequest>(
            createAssessmentTemplateRequest, "AmazonInspector");
    request.addHeader("X-Amz-Target", "InspectorService.CreateAssessmentTemplate");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (createAssessmentTemplateRequest.getAssessmentTargetArn() != null) {
        jsonGenerator
            .writeFieldName("assessmentTargetArn")
            .writeValue(createAssessmentTemplateRequest.getAssessmentTargetArn());
      }
      if (createAssessmentTemplateRequest.getAssessmentTemplateName() != null) {
        jsonGenerator
            .writeFieldName("assessmentTemplateName")
            .writeValue(createAssessmentTemplateRequest.getAssessmentTemplateName());
      }
      if (createAssessmentTemplateRequest.getDurationInSeconds() != null) {
        jsonGenerator
            .writeFieldName("durationInSeconds")
            .writeValue(createAssessmentTemplateRequest.getDurationInSeconds());
      }

      java.util.List<String> rulesPackageArnsList =
          createAssessmentTemplateRequest.getRulesPackageArns();
      if (rulesPackageArnsList != null) {
        jsonGenerator.writeFieldName("rulesPackageArns");
        jsonGenerator.writeStartArray();
        for (String rulesPackageArnsListValue : rulesPackageArnsList) {
          if (rulesPackageArnsListValue != null) {
            jsonGenerator.writeValue(rulesPackageArnsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      java.util.List<Attribute> userAttributesForFindingsList =
          createAssessmentTemplateRequest.getUserAttributesForFindings();
      if (userAttributesForFindingsList != null) {
        jsonGenerator.writeFieldName("userAttributesForFindings");
        jsonGenerator.writeStartArray();
        for (Attribute userAttributesForFindingsListValue : userAttributesForFindingsList) {
          if (userAttributesForFindingsListValue != null) {

            AttributeJsonMarshaller.getInstance()
                .marshall(userAttributesForFindingsListValue, jsonGenerator);
          }
        }
        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", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  /** 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);
    }
  }