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

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

    try {
      jsonGenerator.writeStartObject();

      if (workflowTypeConfiguration.getDefaultTaskStartToCloseTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskStartToCloseTimeout")
            .writeValue(workflowTypeConfiguration.getDefaultTaskStartToCloseTimeout());
      }
      if (workflowTypeConfiguration.getDefaultExecutionStartToCloseTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultExecutionStartToCloseTimeout")
            .writeValue(workflowTypeConfiguration.getDefaultExecutionStartToCloseTimeout());
      }
      if (workflowTypeConfiguration.getDefaultTaskList() != null) {
        jsonGenerator.writeFieldName("defaultTaskList");
        TaskListJsonMarshaller.getInstance()
            .marshall(workflowTypeConfiguration.getDefaultTaskList(), jsonGenerator);
      }
      if (workflowTypeConfiguration.getDefaultTaskPriority() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskPriority")
            .writeValue(workflowTypeConfiguration.getDefaultTaskPriority());
      }
      if (workflowTypeConfiguration.getDefaultChildPolicy() != null) {
        jsonGenerator
            .writeFieldName("defaultChildPolicy")
            .writeValue(workflowTypeConfiguration.getDefaultChildPolicy());
      }
      if (workflowTypeConfiguration.getDefaultLambdaRole() != null) {
        jsonGenerator
            .writeFieldName("defaultLambdaRole")
            .writeValue(workflowTypeConfiguration.getDefaultLambdaRole());
      }

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

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

    Request<RegisterActivityTypeRequest> request =
        new DefaultRequest<RegisterActivityTypeRequest>(
            registerActivityTypeRequest, "AmazonSimpleWorkflow");
    request.addHeader("X-Amz-Target", "SimpleWorkflowService.RegisterActivityType");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (registerActivityTypeRequest.getDomain() != null) {
        jsonGenerator.writeFieldName("domain").writeValue(registerActivityTypeRequest.getDomain());
      }
      if (registerActivityTypeRequest.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(registerActivityTypeRequest.getName());
      }
      if (registerActivityTypeRequest.getVersion() != null) {
        jsonGenerator
            .writeFieldName("version")
            .writeValue(registerActivityTypeRequest.getVersion());
      }
      if (registerActivityTypeRequest.getDescription() != null) {
        jsonGenerator
            .writeFieldName("description")
            .writeValue(registerActivityTypeRequest.getDescription());
      }
      if (registerActivityTypeRequest.getDefaultTaskStartToCloseTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskStartToCloseTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskStartToCloseTimeout());
      }
      if (registerActivityTypeRequest.getDefaultTaskHeartbeatTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskHeartbeatTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskHeartbeatTimeout());
      }
      if (registerActivityTypeRequest.getDefaultTaskList() != null) {
        jsonGenerator.writeFieldName("defaultTaskList");
        TaskListJsonMarshaller.getInstance()
            .marshall(registerActivityTypeRequest.getDefaultTaskList(), jsonGenerator);
      }
      if (registerActivityTypeRequest.getDefaultTaskPriority() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskPriority")
            .writeValue(registerActivityTypeRequest.getDefaultTaskPriority());
      }
      if (registerActivityTypeRequest.getDefaultTaskScheduleToStartTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskScheduleToStartTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskScheduleToStartTimeout());
      }
      if (registerActivityTypeRequest.getDefaultTaskScheduleToCloseTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskScheduleToCloseTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskScheduleToCloseTimeout());
      }

      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;
  }