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

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

    try {
      jsonGenerator.writeStartObject();

      if (failWorkflowExecutionFailedEventAttributes.getCause() != null) {
        jsonGenerator
            .writeFieldName("cause")
            .writeValue(failWorkflowExecutionFailedEventAttributes.getCause());
      }
      if (failWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId() != null) {
        jsonGenerator
            .writeFieldName("decisionTaskCompletedEventId")
            .writeValue(
                failWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId());
      }

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

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

    Request<RespondDecisionTaskCompletedRequest> request =
        new DefaultRequest<RespondDecisionTaskCompletedRequest>(
            respondDecisionTaskCompletedRequest, "AmazonSimpleWorkflow");
    request.addHeader("X-Amz-Target", "SimpleWorkflowService.RespondDecisionTaskCompleted");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (respondDecisionTaskCompletedRequest.getTaskToken() != null) {
        jsonGenerator
            .writeFieldName("taskToken")
            .writeValue(respondDecisionTaskCompletedRequest.getTaskToken());
      }

      java.util.List<Decision> decisionsList = respondDecisionTaskCompletedRequest.getDecisions();
      if (decisionsList != null) {
        jsonGenerator.writeFieldName("decisions");
        jsonGenerator.writeStartArray();
        for (Decision decisionsListValue : decisionsList) {
          if (decisionsListValue != null) {

            DecisionJsonMarshaller.getInstance().marshall(decisionsListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (respondDecisionTaskCompletedRequest.getExecutionContext() != null) {
        jsonGenerator
            .writeFieldName("executionContext")
            .writeValue(respondDecisionTaskCompletedRequest.getExecutionContext());
      }

      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(
      SignalExternalWorkflowExecutionInitiatedEventAttributes
          signalExternalWorkflowExecutionInitiatedEventAttributes,
      StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (signalExternalWorkflowExecutionInitiatedEventAttributes.getWorkflowId() != null) {
        jsonGenerator
            .writeFieldName("workflowId")
            .writeValue(signalExternalWorkflowExecutionInitiatedEventAttributes.getWorkflowId());
      }
      if (signalExternalWorkflowExecutionInitiatedEventAttributes.getRunId() != null) {
        jsonGenerator
            .writeFieldName("runId")
            .writeValue(signalExternalWorkflowExecutionInitiatedEventAttributes.getRunId());
      }
      if (signalExternalWorkflowExecutionInitiatedEventAttributes.getSignalName() != null) {
        jsonGenerator
            .writeFieldName("signalName")
            .writeValue(signalExternalWorkflowExecutionInitiatedEventAttributes.getSignalName());
      }
      if (signalExternalWorkflowExecutionInitiatedEventAttributes.getInput() != null) {
        jsonGenerator
            .writeFieldName("input")
            .writeValue(signalExternalWorkflowExecutionInitiatedEventAttributes.getInput());
      }
      if (signalExternalWorkflowExecutionInitiatedEventAttributes.getDecisionTaskCompletedEventId()
          != null) {
        jsonGenerator
            .writeFieldName("decisionTaskCompletedEventId")
            .writeValue(
                signalExternalWorkflowExecutionInitiatedEventAttributes
                    .getDecisionTaskCompletedEventId());
      }
      if (signalExternalWorkflowExecutionInitiatedEventAttributes.getControl() != null) {
        jsonGenerator
            .writeFieldName("control")
            .writeValue(signalExternalWorkflowExecutionInitiatedEventAttributes.getControl());
      }

      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(
      ExecutionTimeFilter executionTimeFilter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (executionTimeFilter.getOldestDate() != null) {
        jsonGenerator.writeFieldName("oldestDate").writeValue(executionTimeFilter.getOldestDate());
      }
      if (executionTimeFilter.getLatestDate() != null) {
        jsonGenerator.writeFieldName("latestDate").writeValue(executionTimeFilter.getLatestDate());
      }

      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(
      RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes,
      StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (requestCancelActivityTaskDecisionAttributes.getActivityId() != null) {
        jsonGenerator
            .writeFieldName("activityId")
            .writeValue(requestCancelActivityTaskDecisionAttributes.getActivityId());
      }

      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(
      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<RespondActivityTaskFailedRequest> marshall(
      RespondActivityTaskFailedRequest respondActivityTaskFailedRequest) {

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

    Request<RespondActivityTaskFailedRequest> request =
        new DefaultRequest<RespondActivityTaskFailedRequest>(
            respondActivityTaskFailedRequest, "AmazonSimpleWorkflow");
    request.addHeader("X-Amz-Target", "SimpleWorkflowService.RespondActivityTaskFailed");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (respondActivityTaskFailedRequest.getTaskToken() != null) {
        jsonGenerator
            .writeFieldName("taskToken")
            .writeValue(respondActivityTaskFailedRequest.getTaskToken());
      }
      if (respondActivityTaskFailedRequest.getReason() != null) {
        jsonGenerator
            .writeFieldName("reason")
            .writeValue(respondActivityTaskFailedRequest.getReason());
      }
      if (respondActivityTaskFailedRequest.getDetails() != null) {
        jsonGenerator
            .writeFieldName("details")
            .writeValue(respondActivityTaskFailedRequest.getDetails());
      }

      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(
      ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes,
      StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (activityTaskFailedEventAttributes.getReason() != null) {
        jsonGenerator
            .writeFieldName("reason")
            .writeValue(activityTaskFailedEventAttributes.getReason());
      }
      if (activityTaskFailedEventAttributes.getDetails() != null) {
        jsonGenerator
            .writeFieldName("details")
            .writeValue(activityTaskFailedEventAttributes.getDetails());
      }
      if (activityTaskFailedEventAttributes.getScheduledEventId() != null) {
        jsonGenerator
            .writeFieldName("scheduledEventId")
            .writeValue(activityTaskFailedEventAttributes.getScheduledEventId());
      }
      if (activityTaskFailedEventAttributes.getStartedEventId() != null) {
        jsonGenerator
            .writeFieldName("startedEventId")
            .writeValue(activityTaskFailedEventAttributes.getStartedEventId());
      }

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