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

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

    try {
      jsonGenerator.writeStartObject();

      if (s3Location.getBucket() != null) {
        jsonGenerator.writeFieldName("bucket").writeValue(s3Location.getBucket());
      }
      if (s3Location.getKey() != null) {
        jsonGenerator.writeFieldName("key").writeValue(s3Location.getKey());
      }
      if (s3Location.getBundleType() != null) {
        jsonGenerator.writeFieldName("bundleType").writeValue(s3Location.getBundleType());
      }
      if (s3Location.getVersion() != null) {
        jsonGenerator.writeFieldName("version").writeValue(s3Location.getVersion());
      }
      if (s3Location.getETag() != null) {
        jsonGenerator.writeFieldName("eTag").writeValue(s3Location.getETag());
      }

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

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

    Request<ListOnPremisesInstancesRequest> request =
        new DefaultRequest<ListOnPremisesInstancesRequest>(
            listOnPremisesInstancesRequest, "AmazonCodeDeploy");
    request.addHeader("X-Amz-Target", "CodeDeploy_20141006.ListOnPremisesInstances");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (listOnPremisesInstancesRequest.getRegistrationStatus() != null) {
        jsonGenerator
            .writeFieldName("registrationStatus")
            .writeValue(listOnPremisesInstancesRequest.getRegistrationStatus());
      }

      com.amazonaws.internal.SdkInternalList<TagFilter> tagFiltersList =
          (com.amazonaws.internal.SdkInternalList<TagFilter>)
              listOnPremisesInstancesRequest.getTagFilters();
      if (!tagFiltersList.isEmpty() || !tagFiltersList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("tagFilters");
        jsonGenerator.writeStartArray();
        for (TagFilter tagFiltersListValue : tagFiltersList) {
          if (tagFiltersListValue != null) {

            TagFilterJsonMarshaller.getInstance().marshall(tagFiltersListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (listOnPremisesInstancesRequest.getNextToken() != null) {
        jsonGenerator
            .writeFieldName("nextToken")
            .writeValue(listOnPremisesInstancesRequest.getNextToken());
      }

      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;
  }
  public Request<RegisterOnPremisesInstanceRequest> marshall(
      RegisterOnPremisesInstanceRequest registerOnPremisesInstanceRequest) {

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

    Request<RegisterOnPremisesInstanceRequest> request =
        new DefaultRequest<RegisterOnPremisesInstanceRequest>(
            registerOnPremisesInstanceRequest, "AmazonCodeDeploy");
    request.addHeader("X-Amz-Target", "CodeDeploy_20141006.RegisterOnPremisesInstance");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (registerOnPremisesInstanceRequest.getInstanceName() != null) {
        jsonGenerator
            .writeFieldName("instanceName")
            .writeValue(registerOnPremisesInstanceRequest.getInstanceName());
      }
      if (registerOnPremisesInstanceRequest.getIamUserArn() != null) {
        jsonGenerator
            .writeFieldName("iamUserArn")
            .writeValue(registerOnPremisesInstanceRequest.getIamUserArn());
      }

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