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

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

    try {
      jsonGenerator.writeStartObject();

      if (pipelineSummary.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(pipelineSummary.getName());
      }
      if (pipelineSummary.getVersion() != null) {
        jsonGenerator.writeFieldName("version").writeValue(pipelineSummary.getVersion());
      }
      if (pipelineSummary.getCreated() != null) {
        jsonGenerator.writeFieldName("created").writeValue(pipelineSummary.getCreated());
      }
      if (pipelineSummary.getUpdated() != null) {
        jsonGenerator.writeFieldName("updated").writeValue(pipelineSummary.getUpdated());
      }

      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 JSONWriter */
  public void marshall(ActionRevision actionRevision, JSONWriter jsonWriter) {
    if (actionRevision == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (actionRevision.getRevisionId() != null) {
        jsonWriter.key("revisionId").value(actionRevision.getRevisionId());
      }

      if (actionRevision.getRevisionChangeId() != null) {
        jsonWriter.key("revisionChangeId").value(actionRevision.getRevisionChangeId());
      }

      if (actionRevision.getCreated() != null) {
        jsonWriter.key("created").value(actionRevision.getCreated());
      }

      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(Snapshot snapshot, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (snapshot.getDirectoryId() != null) {
        jsonGenerator.writeFieldName("DirectoryId").writeValue(snapshot.getDirectoryId());
      }
      if (snapshot.getSnapshotId() != null) {
        jsonGenerator.writeFieldName("SnapshotId").writeValue(snapshot.getSnapshotId());
      }
      if (snapshot.getType() != null) {
        jsonGenerator.writeFieldName("Type").writeValue(snapshot.getType());
      }
      if (snapshot.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(snapshot.getName());
      }
      if (snapshot.getStatus() != null) {
        jsonGenerator.writeFieldName("Status").writeValue(snapshot.getStatus());
      }
      if (snapshot.getStartTime() != null) {
        jsonGenerator.writeFieldName("StartTime").writeValue(snapshot.getStartTime());
      }

      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 JSONWriter */
  public void marshall(Artifact artifact, JSONWriter jsonWriter) {
    if (artifact == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (artifact.getName() != null) {
        jsonWriter.key("name").value(artifact.getName());
      }

      if (artifact.getRevision() != null) {
        jsonWriter.key("revision").value(artifact.getRevision());
      }

      if (artifact.getLocation() != null) {
        jsonWriter.key("location");
        ArtifactLocationJsonMarshaller.getInstance().marshall(artifact.getLocation(), jsonWriter);
      }

      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 JSONWriter */
  public void marshall(OperationSummary operationSummary, JSONWriter jsonWriter) {
    if (operationSummary == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (operationSummary.getOperationId() != null) {
        jsonWriter.key("OperationId").value(operationSummary.getOperationId());
      }

      if (operationSummary.getStatus() != null) {
        jsonWriter.key("Status").value(operationSummary.getStatus());
      }

      if (operationSummary.getType() != null) {
        jsonWriter.key("Type").value(operationSummary.getType());
      }

      if (operationSummary.getSubmittedDate() != null) {
        jsonWriter.key("SubmittedDate").value(operationSummary.getSubmittedDate());
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<CreateWorkspacesRequest> marshall(
      CreateWorkspacesRequest createWorkspacesRequest) {
    if (createWorkspacesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<CreateWorkspacesRequest> request =
        new DefaultRequest<CreateWorkspacesRequest>(createWorkspacesRequest, "AmazonWorkspaces");
    String target = "WorkspacesService.CreateWorkspaces";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

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

      jsonWriter.object();

      com.amazonaws.internal.ListWithAutoConstructFlag<WorkspaceRequest> workspacesList =
          (com.amazonaws.internal.ListWithAutoConstructFlag<WorkspaceRequest>)
              (createWorkspacesRequest.getWorkspaces());
      if (workspacesList != null
          && !(workspacesList.isAutoConstruct() && workspacesList.isEmpty())) {

        jsonWriter.key("Workspaces");
        jsonWriter.array();

        for (WorkspaceRequest workspacesListValue : workspacesList) {
          if (workspacesListValue != null) {
            jsonWriter.object();
            if (workspacesListValue.getDirectoryId() != null) {
              jsonWriter.key("DirectoryId").value(workspacesListValue.getDirectoryId());
            }
            if (workspacesListValue.getUserName() != null) {
              jsonWriter.key("UserName").value(workspacesListValue.getUserName());
            }
            if (workspacesListValue.getBundleId() != null) {
              jsonWriter.key("BundleId").value(workspacesListValue.getBundleId());
            }
            jsonWriter.endObject();
          }
        }
        jsonWriter.endArray();
      }

      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;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(Notifications notifications, JSONWriter jsonWriter) {
    if (notifications == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (notifications.getProgressing() != null) {
        jsonWriter.key("Progressing").value(notifications.getProgressing());
      }

      if (notifications.getCompleted() != null) {
        jsonWriter.key("Completed").value(notifications.getCompleted());
      }

      if (notifications.getWarning() != null) {
        jsonWriter.key("Warning").value(notifications.getWarning());
      }

      if (notifications.getError() != null) {
        jsonWriter.key("Error").value(notifications.getError());
      }

      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 JSONWriter */
  public void marshall(DetectedProperties detectedProperties, JSONWriter jsonWriter) {
    if (detectedProperties == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (detectedProperties.getWidth() != null) {
        jsonWriter.key("Width").value(detectedProperties.getWidth());
      }

      if (detectedProperties.getHeight() != null) {
        jsonWriter.key("Height").value(detectedProperties.getHeight());
      }

      if (detectedProperties.getFrameRate() != null) {
        jsonWriter.key("FrameRate").value(detectedProperties.getFrameRate());
      }

      if (detectedProperties.getFileSize() != null) {
        jsonWriter.key("FileSize").value(detectedProperties.getFileSize());
      }

      if (detectedProperties.getDurationMillis() != null) {
        jsonWriter.key("DurationMillis").value(detectedProperties.getDurationMillis());
      }

      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 JSONWriter */
  public void marshall(EC2TagFilter eC2TagFilter, JSONWriter jsonWriter) {
    if (eC2TagFilter == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (eC2TagFilter.getKey() != null) {
        jsonWriter.key("Key").value(eC2TagFilter.getKey());
      }

      if (eC2TagFilter.getValue() != null) {
        jsonWriter.key("Value").value(eC2TagFilter.getValue());
      }

      if (eC2TagFilter.getType() != null) {
        jsonWriter.key("Type").value(eC2TagFilter.getType());
      }

      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(Encryption encryption, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (encryption.getMode() != null) {
        jsonGenerator.writeFieldName("Mode").writeValue(encryption.getMode());
      }
      if (encryption.getKey() != null) {
        jsonGenerator.writeFieldName("Key").writeValue(encryption.getKey());
      }
      if (encryption.getKeyMd5() != null) {
        jsonGenerator.writeFieldName("KeyMd5").writeValue(encryption.getKeyMd5());
      }
      if (encryption.getInitializationVector() != null) {
        jsonGenerator
            .writeFieldName("InitializationVector")
            .writeValue(encryption.getInitializationVector());
      }

      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 JSONWriter */
  public void marshall(TemporaryCredential temporaryCredential, JSONWriter jsonWriter) {
    if (temporaryCredential == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (temporaryCredential.getUsername() != null) {
        jsonWriter.key("Username").value(temporaryCredential.getUsername());
      }

      if (temporaryCredential.getPassword() != null) {
        jsonWriter.key("Password").value(temporaryCredential.getPassword());
      }

      if (temporaryCredential.getValidForInMinutes() != null) {
        jsonWriter.key("ValidForInMinutes").value(temporaryCredential.getValidForInMinutes());
      }

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

      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 JSONWriter */
  public void marshall(Telemetry telemetry, JSONWriter jsonWriter) {
    if (telemetry == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (telemetry.getStatus() != null) {
        jsonWriter.key("status").value(telemetry.getStatus());
      }

      java.util.List<MessageTypeTelemetry> messageTypeTelemetriesList =
          telemetry.getMessageTypeTelemetries();
      if (messageTypeTelemetriesList != null) {
        jsonWriter.key("messageTypeTelemetries");
        jsonWriter.array();
        for (MessageTypeTelemetry messageTypeTelemetriesListValue : messageTypeTelemetriesList) {
          if (messageTypeTelemetriesListValue != null) {

            MessageTypeTelemetryJsonMarshaller.getInstance()
                .marshall(messageTypeTelemetriesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      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(FleetUtilization fleetUtilization, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (fleetUtilization.getFleetId() != null) {
        jsonGenerator.writeFieldName("FleetId").writeValue(fleetUtilization.getFleetId());
      }
      if (fleetUtilization.getActiveGameSessionCount() != null) {
        jsonGenerator
            .writeFieldName("ActiveGameSessionCount")
            .writeValue(fleetUtilization.getActiveGameSessionCount());
      }
      if (fleetUtilization.getCurrentPlayerSessionCount() != null) {
        jsonGenerator
            .writeFieldName("CurrentPlayerSessionCount")
            .writeValue(fleetUtilization.getCurrentPlayerSessionCount());
      }
      if (fleetUtilization.getMaximumPlayerSessionCount() != null) {
        jsonGenerator
            .writeFieldName("MaximumPlayerSessionCount")
            .writeValue(fleetUtilization.getMaximumPlayerSessionCount());
      }

      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 JSONWriter */
  public void marshall(Service service, JSONWriter jsonWriter) {
    if (service == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (service.getCode() != null) {
        jsonWriter.key("code").value(service.getCode());
      }

      if (service.getName() != null) {
        jsonWriter.key("name").value(service.getName());
      }

      com.amazonaws.internal.SdkInternalList<Category> categoriesList =
          (com.amazonaws.internal.SdkInternalList<Category>) service.getCategories();
      if (!categoriesList.isEmpty() || !categoriesList.isAutoConstruct()) {
        jsonWriter.key("categories");
        jsonWriter.array();
        for (Category categoriesListValue : categoriesList) {
          if (categoriesListValue != null) {

            CategoryJsonMarshaller.getInstance().marshall(categoriesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<ListTablesRequest> marshall(ListTablesRequest listTablesRequest) {
    if (listTablesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<ListTablesRequest> request =
        new DefaultRequest<ListTablesRequest>(listTablesRequest, "AmazonDynamoDBv2");
    String target = "DynamoDB_20120810.ListTables";
    request.addHeader("X-Amz-Target", target);
    request.addHeader("Content-Type", "application/x-amz-json-1.0");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "";

    uriResourcePath = uriResourcePath.replaceAll("//", "/");

    if (uriResourcePath.contains("?")) {
      String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1);
      uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?"));

      for (String s : queryString.split("[;&]")) {
        String[] nameValuePair = s.split("=");
        if (nameValuePair.length == 2) {
          request.addParameter(nameValuePair[0], nameValuePair[1]);
        } else {
          request.addParameter(s, null);
        }
      }
    }

    request.setResourcePath(uriResourcePath);

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

      jsonWriter.object();

      if (listTablesRequest.getExclusiveStartTableName() != null) {
        jsonWriter
            .key("ExclusiveStartTableName")
            .value(listTablesRequest.getExclusiveStartTableName());
      }
      if (listTablesRequest.getLimit() != null) {
        jsonWriter.key("Limit").value(listTablesRequest.getLimit());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes("UTF-8");
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
    } 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(ParameterObject parameterObject, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (parameterObject.getId() != null) {
        jsonGenerator.writeFieldName("id").writeValue(parameterObject.getId());
      }

      com.amazonaws.internal.SdkInternalList<ParameterAttribute> attributesList =
          (com.amazonaws.internal.SdkInternalList<ParameterAttribute>)
              parameterObject.getAttributes();
      if (!attributesList.isEmpty() || !attributesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("attributes");
        jsonGenerator.writeStartArray();
        for (ParameterAttribute attributesListValue : attributesList) {
          if (attributesListValue != null) {

            ParameterAttributeJsonMarshaller.getInstance()
                .marshall(attributesListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }

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

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

    Request<DescribeEcsClustersRequest> request =
        new DefaultRequest<DescribeEcsClustersRequest>(describeEcsClustersRequest, "AWSOpsWorks");
    request.addHeader("X-Amz-Target", "OpsWorks_20130218.DescribeEcsClusters");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator =
          SdkJsonProtocolFactory.createWriter(false, "1.1");

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<String> ecsClusterArnsList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeEcsClustersRequest.getEcsClusterArns();
      if (!ecsClusterArnsList.isEmpty() || !ecsClusterArnsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("EcsClusterArns");
        jsonGenerator.writeStartArray();
        for (String ecsClusterArnsListValue : ecsClusterArnsList) {
          if (ecsClusterArnsListValue != null) {
            jsonGenerator.writeValue(ecsClusterArnsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (describeEcsClustersRequest.getStackId() != null) {
        jsonGenerator.writeFieldName("StackId").writeValue(describeEcsClustersRequest.getStackId());
      }
      if (describeEcsClustersRequest.getNextToken() != null) {
        jsonGenerator
            .writeFieldName("NextToken")
            .writeValue(describeEcsClustersRequest.getNextToken());
      }
      if (describeEcsClustersRequest.getMaxResults() != null) {
        jsonGenerator
            .writeFieldName("MaxResults")
            .writeValue(describeEcsClustersRequest.getMaxResults());
      }

      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<CreateSnapshotRequest> marshall(CreateSnapshotRequest createSnapshotRequest) {
    if (createSnapshotRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<CreateSnapshotRequest> request =
        new DefaultRequest<CreateSnapshotRequest>(createSnapshotRequest, "AWSStorageGateway");
    String target = "StorageGateway_20130630.CreateSnapshot";
    request.addHeader("X-Amz-Target", target);
    request.addHeader("Content-Type", "application/x-amz-json-1.1");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "";

    uriResourcePath = uriResourcePath.replaceAll("//", "/");

    if (uriResourcePath.contains("?")) {
      String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1);
      uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?"));

      for (String s : queryString.split("[;&]")) {
        String[] nameValuePair = s.split("=");
        if (nameValuePair.length == 2) {
          request.addParameter(nameValuePair[0], nameValuePair[1]);
        } else {
          request.addParameter(s, null);
        }
      }
    }

    request.setResourcePath(uriResourcePath);

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

      jsonWriter.object();

      if (createSnapshotRequest.getVolumeARN() != null) {
        jsonWriter.key("VolumeARN").value(createSnapshotRequest.getVolumeARN());
      }
      if (createSnapshotRequest.getSnapshotDescription() != null) {
        jsonWriter.key("SnapshotDescription").value(createSnapshotRequest.getSnapshotDescription());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes("UTF-8");
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<UpdateDomainNameserversRequest> marshall(
      UpdateDomainNameserversRequest updateDomainNameserversRequest) {

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

    Request<UpdateDomainNameserversRequest> request =
        new DefaultRequest<UpdateDomainNameserversRequest>(
            updateDomainNameserversRequest, "AmazonRoute53Domains");
    request.addHeader("X-Amz-Target", "Route53Domains_v20140515.UpdateDomainNameservers");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

      if (updateDomainNameserversRequest.getDomainName() != null) {
        jsonWriter.key("DomainName").value(updateDomainNameserversRequest.getDomainName());
      }

      if (updateDomainNameserversRequest.getFIAuthKey() != null) {
        jsonWriter.key("FIAuthKey").value(updateDomainNameserversRequest.getFIAuthKey());
      }

      com.amazonaws.internal.SdkInternalList<Nameserver> nameserversList =
          (com.amazonaws.internal.SdkInternalList<Nameserver>)
              updateDomainNameserversRequest.getNameservers();
      if (!nameserversList.isEmpty() || !nameserversList.isAutoConstruct()) {
        jsonWriter.key("Nameservers");
        jsonWriter.array();
        for (Nameserver nameserversListValue : nameserversList) {
          if (nameserversListValue != null) {

            NameserverJsonMarshaller.getInstance().marshall(nameserversListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      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<CreateHsmRequest> marshall(CreateHsmRequest createHsmRequest) {
    if (createHsmRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<CreateHsmRequest> request =
        new DefaultRequest<CreateHsmRequest>(createHsmRequest, "AWSCloudHSM");
    String target = "CloudHsmFrontendService.CreateHsm";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

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

      jsonWriter.object();

      if (createHsmRequest.getSubnetId() != null) {
        jsonWriter.key("SubnetId").value(createHsmRequest.getSubnetId());
      }
      if (createHsmRequest.getSshKey() != null) {
        jsonWriter.key("SshKey").value(createHsmRequest.getSshKey());
      }
      if (createHsmRequest.getEniIp() != null) {
        jsonWriter.key("EniIp").value(createHsmRequest.getEniIp());
      }
      if (createHsmRequest.getIamRoleArn() != null) {
        jsonWriter.key("IamRoleArn").value(createHsmRequest.getIamRoleArn());
      }
      if (createHsmRequest.getExternalId() != null) {
        jsonWriter.key("ExternalId").value(createHsmRequest.getExternalId());
      }
      if (createHsmRequest.getSubscriptionType() != null) {
        jsonWriter.key("SubscriptionType").value(createHsmRequest.getSubscriptionType());
      }
      if (createHsmRequest.getClientToken() != null) {
        jsonWriter.key("ClientToken").value(createHsmRequest.getClientToken());
      }
      if (createHsmRequest.getSyslogIp() != null) {
        jsonWriter.key("SyslogIp").value(createHsmRequest.getSyslogIp());
      }

      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<CreateIdentityPoolRequest> marshall(
      CreateIdentityPoolRequest createIdentityPoolRequest) {
    if (createIdentityPoolRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<CreateIdentityPoolRequest> request =
        new DefaultRequest<CreateIdentityPoolRequest>(
            createIdentityPoolRequest, "AmazonCognitoIdentity");
    String target = "AWSCognitoIdentityService.CreateIdentityPool";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

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

      jsonWriter.object();

      if (createIdentityPoolRequest.getIdentityPoolName() != null) {
        jsonWriter.key("IdentityPoolName").value(createIdentityPoolRequest.getIdentityPoolName());
      }
      if (createIdentityPoolRequest.isAllowUnauthenticatedIdentities() != null) {
        jsonWriter
            .key("AllowUnauthenticatedIdentities")
            .value(createIdentityPoolRequest.isAllowUnauthenticatedIdentities());
      }
      if (createIdentityPoolRequest.getSupportedLoginProviders() != null) {
        jsonWriter.key("SupportedLoginProviders");
        jsonWriter.object();
        for (Map.Entry<String, String> supportedLoginProvidersListValue :
            createIdentityPoolRequest.getSupportedLoginProviders().entrySet()) {
          if (supportedLoginProvidersListValue.getValue() != null) {
            jsonWriter.key(supportedLoginProvidersListValue.getKey());

            jsonWriter.value(supportedLoginProvidersListValue.getValue());
          }
        }
        jsonWriter.endObject();
      }

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

    return request;
  }
  public Request<SetIdentityPoolRolesRequest> marshall(
      SetIdentityPoolRolesRequest setIdentityPoolRolesRequest) {

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

    Request<SetIdentityPoolRolesRequest> request =
        new DefaultRequest<SetIdentityPoolRolesRequest>(
            setIdentityPoolRolesRequest, "AmazonCognitoIdentity");
    request.addHeader("X-Amz-Target", "AWSCognitoIdentityService.SetIdentityPoolRoles");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

      if (setIdentityPoolRolesRequest.getIdentityPoolId() != null) {
        jsonWriter.key("IdentityPoolId").value(setIdentityPoolRolesRequest.getIdentityPoolId());
      }

      java.util.Map<String, String> rolesMap = setIdentityPoolRolesRequest.getRoles();
      if (rolesMap != null) {
        jsonWriter.key("Roles");
        jsonWriter.object();

        for (Map.Entry<String, String> rolesMapValue : rolesMap.entrySet()) {
          if (rolesMapValue.getValue() != null) {
            jsonWriter.key(rolesMapValue.getKey());

            jsonWriter.value(rolesMapValue.getValue());
          }
        }
        jsonWriter.endObject();
      }

      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;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(TrustedAdvisorCheckResult trustedAdvisorCheckResult, JSONWriter jsonWriter) {
    if (trustedAdvisorCheckResult == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (trustedAdvisorCheckResult.getCheckId() != null) {
        jsonWriter.key("checkId").value(trustedAdvisorCheckResult.getCheckId());
      }

      if (trustedAdvisorCheckResult.getTimestamp() != null) {
        jsonWriter.key("timestamp").value(trustedAdvisorCheckResult.getTimestamp());
      }

      if (trustedAdvisorCheckResult.getStatus() != null) {
        jsonWriter.key("status").value(trustedAdvisorCheckResult.getStatus());
      }

      if (trustedAdvisorCheckResult.getResourcesSummary() != null) {
        jsonWriter.key("resourcesSummary");
        TrustedAdvisorResourcesSummaryJsonMarshaller.getInstance()
            .marshall(trustedAdvisorCheckResult.getResourcesSummary(), jsonWriter);
      }

      if (trustedAdvisorCheckResult.getCategorySpecificSummary() != null) {
        jsonWriter.key("categorySpecificSummary");
        TrustedAdvisorCategorySpecificSummaryJsonMarshaller.getInstance()
            .marshall(trustedAdvisorCheckResult.getCategorySpecificSummary(), jsonWriter);
      }

      com.amazonaws.internal.SdkInternalList<TrustedAdvisorResourceDetail> flaggedResourcesList =
          (com.amazonaws.internal.SdkInternalList<TrustedAdvisorResourceDetail>)
              trustedAdvisorCheckResult.getFlaggedResources();
      if (!flaggedResourcesList.isEmpty() || !flaggedResourcesList.isAutoConstruct()) {
        jsonWriter.key("flaggedResources");
        jsonWriter.array();
        for (TrustedAdvisorResourceDetail flaggedResourcesListValue : flaggedResourcesList) {
          if (flaggedResourcesListValue != null) {

            TrustedAdvisorResourceDetailJsonMarshaller.getInstance()
                .marshall(flaggedResourcesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      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 JSONWriter */
  public void marshall(
      ConfigRuleEvaluationStatus configRuleEvaluationStatus, JSONWriter jsonWriter) {
    if (configRuleEvaluationStatus == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (configRuleEvaluationStatus.getConfigRuleName() != null) {
        jsonWriter.key("ConfigRuleName").value(configRuleEvaluationStatus.getConfigRuleName());
      }

      if (configRuleEvaluationStatus.getConfigRuleArn() != null) {
        jsonWriter.key("ConfigRuleArn").value(configRuleEvaluationStatus.getConfigRuleArn());
      }

      if (configRuleEvaluationStatus.getConfigRuleId() != null) {
        jsonWriter.key("ConfigRuleId").value(configRuleEvaluationStatus.getConfigRuleId());
      }

      if (configRuleEvaluationStatus.getLastSuccessfulInvocationTime() != null) {
        jsonWriter
            .key("LastSuccessfulInvocationTime")
            .value(configRuleEvaluationStatus.getLastSuccessfulInvocationTime());
      }

      if (configRuleEvaluationStatus.getLastFailedInvocationTime() != null) {
        jsonWriter
            .key("LastFailedInvocationTime")
            .value(configRuleEvaluationStatus.getLastFailedInvocationTime());
      }

      if (configRuleEvaluationStatus.getFirstActivatedTime() != null) {
        jsonWriter
            .key("FirstActivatedTime")
            .value(configRuleEvaluationStatus.getFirstActivatedTime());
      }

      if (configRuleEvaluationStatus.getLastErrorCode() != null) {
        jsonWriter.key("LastErrorCode").value(configRuleEvaluationStatus.getLastErrorCode());
      }

      if (configRuleEvaluationStatus.getLastErrorMessage() != null) {
        jsonWriter.key("LastErrorMessage").value(configRuleEvaluationStatus.getLastErrorMessage());
      }

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

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

    Request<CreateResourceRequest> request =
        new DefaultRequest<CreateResourceRequest>(createResourceRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/restapis/{restapi_id}/resources/{parent_id}";

    uriResourcePath =
        uriResourcePath.replace(
            "{restapi_id}",
            (createResourceRequest.getRestApiId() == null)
                ? ""
                : StringUtils.fromString(createResourceRequest.getRestApiId()));
    uriResourcePath =
        uriResourcePath.replace(
            "{parent_id}",
            (createResourceRequest.getParentId() == null)
                ? ""
                : StringUtils.fromString(createResourceRequest.getParentId()));
    request.setResourcePath(uriResourcePath);

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

      jsonWriter.object();

      if (createResourceRequest.getPathPart() != null) {
        jsonWriter.key("pathPart").value(createResourceRequest.getPathPart());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE);
      }
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<ListActivityTypesRequest> marshall(
      ListActivityTypesRequest listActivityTypesRequest) {
    if (listActivityTypesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<ListActivityTypesRequest> request =
        new DefaultRequest<ListActivityTypesRequest>(
            listActivityTypesRequest, "AmazonSimpleWorkflow");
    String target = "SimpleWorkflowService.ListActivityTypes";
    request.addHeader("X-Amz-Target", target);
    request.addHeader("Content-Type", "application/x-amz-json-1.0");
    request.setHttpMethod(POST);

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

      if (listActivityTypesRequest.getDomain() != null) {
        jsonWriter.key("domain").value(listActivityTypesRequest.getDomain());
      }
      if (listActivityTypesRequest.getName() != null) {
        jsonWriter.key("name").value(listActivityTypesRequest.getName());
      }
      if (listActivityTypesRequest.getRegistrationStatus() != null) {
        jsonWriter
            .key("registrationStatus")
            .value(listActivityTypesRequest.getRegistrationStatus());
      }
      if (listActivityTypesRequest.getNextPageToken() != null) {
        jsonWriter.key("nextPageToken").value(listActivityTypesRequest.getNextPageToken());
      }
      if (listActivityTypesRequest.getMaximumPageSize() != null) {
        jsonWriter.key("maximumPageSize").value(listActivityTypesRequest.getMaximumPageSize());
      }
      if (listActivityTypesRequest.isReverseOrder() != null) {
        jsonWriter.key("reverseOrder").value(listActivityTypesRequest.isReverseOrder());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes("UTF-8");
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      return request;
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<UpdateMaintenanceStartTimeRequest> marshall(
      UpdateMaintenanceStartTimeRequest updateMaintenanceStartTimeRequest) {

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

    Request<UpdateMaintenanceStartTimeRequest> request =
        new DefaultRequest<UpdateMaintenanceStartTimeRequest>(
            updateMaintenanceStartTimeRequest, "AWSStorageGateway");
    request.addHeader("X-Amz-Target", "StorageGateway_20130630.UpdateMaintenanceStartTime");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonWriter.object();

      if (updateMaintenanceStartTimeRequest.getGatewayARN() != null) {
        jsonWriter.key("GatewayARN").value(updateMaintenanceStartTimeRequest.getGatewayARN());
      }

      if (updateMaintenanceStartTimeRequest.getHourOfDay() != null) {
        jsonWriter.key("HourOfDay").value(updateMaintenanceStartTimeRequest.getHourOfDay());
      }

      if (updateMaintenanceStartTimeRequest.getMinuteOfHour() != null) {
        jsonWriter.key("MinuteOfHour").value(updateMaintenanceStartTimeRequest.getMinuteOfHour());
      }

      if (updateMaintenanceStartTimeRequest.getDayOfWeek() != null) {
        jsonWriter.key("DayOfWeek").value(updateMaintenanceStartTimeRequest.getDayOfWeek());
      }

      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<DescribeRulesPackagesRequest> marshall(
      DescribeRulesPackagesRequest describeRulesPackagesRequest) {

    if (describeRulesPackagesRequest == null) {
      throw new AmazonClientException("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 =
          SdkJsonProtocolFactory.createWriter(false, "1.1");

      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", jsonGenerator.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("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;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(FileSystemDescription fileSystemDescription, JSONWriter jsonWriter) {
    if (fileSystemDescription == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (fileSystemDescription.getOwnerId() != null) {
        jsonWriter.key("OwnerId").value(fileSystemDescription.getOwnerId());
      }

      if (fileSystemDescription.getCreationToken() != null) {
        jsonWriter.key("CreationToken").value(fileSystemDescription.getCreationToken());
      }

      if (fileSystemDescription.getFileSystemId() != null) {
        jsonWriter.key("FileSystemId").value(fileSystemDescription.getFileSystemId());
      }

      if (fileSystemDescription.getCreationTime() != null) {
        jsonWriter.key("CreationTime").value(fileSystemDescription.getCreationTime());
      }

      if (fileSystemDescription.getLifeCycleState() != null) {
        jsonWriter.key("LifeCycleState").value(fileSystemDescription.getLifeCycleState());
      }

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

      if (fileSystemDescription.getNumberOfMountTargets() != null) {
        jsonWriter
            .key("NumberOfMountTargets")
            .value(fileSystemDescription.getNumberOfMountTargets());
      }

      if (fileSystemDescription.getSizeInBytes() != null) {
        jsonWriter.key("SizeInBytes");
        FileSystemSizeJsonMarshaller.getInstance()
            .marshall(fileSystemDescription.getSizeInBytes(), jsonWriter);
      }

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