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

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

    try {
      jsonGenerator.writeStartObject();

      if (pipelineContext.getPipelineName() != null) {
        jsonGenerator.writeFieldName("pipelineName").writeValue(pipelineContext.getPipelineName());
      }
      if (pipelineContext.getStage() != null) {
        jsonGenerator.writeFieldName("stage");
        StageContextJsonMarshaller.getInstance()
            .marshall(pipelineContext.getStage(), jsonGenerator);
      }
      if (pipelineContext.getAction() != null) {
        jsonGenerator.writeFieldName("action");
        ActionContextJsonMarshaller.getInstance()
            .marshall(pipelineContext.getAction(), jsonGenerator);
      }

      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(CurrentRevision currentRevision, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (currentRevision.getRevision() != null) {
        jsonGenerator.writeFieldName("revision").writeValue(currentRevision.getRevision());
      }
      if (currentRevision.getChangeIdentifier() != null) {
        jsonGenerator
            .writeFieldName("changeIdentifier")
            .writeValue(currentRevision.getChangeIdentifier());
      }
      if (currentRevision.getCreated() != null) {
        jsonGenerator.writeFieldName("created").writeValue(currentRevision.getCreated());
      }
      if (currentRevision.getRevisionSummary() != null) {
        jsonGenerator
            .writeFieldName("revisionSummary")
            .writeValue(currentRevision.getRevisionSummary());
      }

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

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

    Request<DeletePipelineRequest> request =
        new DefaultRequest<DeletePipelineRequest>(deletePipelineRequest, "AWSCodePipeline");
    request.addHeader("X-Amz-Target", "CodePipeline_20150709.DeletePipeline");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (deletePipelineRequest.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(deletePipelineRequest.getName());
      }

      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(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(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 SdkJsonGenerator */
  public void marshall(StageContext stageContext, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (stageContext.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(stageContext.getName());
      }

      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(ThirdPartyJob thirdPartyJob, JSONWriter jsonWriter) {
    if (thirdPartyJob == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (thirdPartyJob.getClientId() != null) {
        jsonWriter.key("clientId").value(thirdPartyJob.getClientId());
      }

      if (thirdPartyJob.getJobId() != null) {
        jsonWriter.key("jobId").value(thirdPartyJob.getJobId());
      }

      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(StageExecution stageExecution, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (stageExecution.getPipelineExecutionId() != null) {
        jsonGenerator
            .writeFieldName("pipelineExecutionId")
            .writeValue(stageExecution.getPipelineExecutionId());
      }
      if (stageExecution.getStatus() != null) {
        jsonGenerator.writeFieldName("status").writeValue(stageExecution.getStatus());
      }

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