/** 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<DescribePipelinesRequest> marshall(
      DescribePipelinesRequest describePipelinesRequest) {

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

    Request<DescribePipelinesRequest> request =
        new DefaultRequest<DescribePipelinesRequest>(describePipelinesRequest, "DataPipeline");
    request.addHeader("X-Amz-Target", "DataPipeline.DescribePipelines");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<String> pipelineIdsList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describePipelinesRequest.getPipelineIds();
      if (!pipelineIdsList.isEmpty() || !pipelineIdsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("pipelineIds");
        jsonGenerator.writeStartArray();
        for (String pipelineIdsListValue : pipelineIdsList) {
          if (pipelineIdsListValue != null) {
            jsonGenerator.writeValue(pipelineIdsListValue);
          }
        }
        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;
  }