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

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

    try {
      jsonGenerator.writeStartObject();

      if (volumeInfo.getVolumeARN() != null) {
        jsonGenerator.writeFieldName("VolumeARN").writeValue(volumeInfo.getVolumeARN());
      }
      if (volumeInfo.getVolumeType() != null) {
        jsonGenerator.writeFieldName("VolumeType").writeValue(volumeInfo.getVolumeType());
      }

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

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

    Request<DeleteFileShareRequest> request =
        new DefaultRequest<DeleteFileShareRequest>(deleteFileShareRequest, "AWSStorageGateway");
    request.addHeader("X-Amz-Target", "StorageGateway_20130630.DeleteFileShare");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (deleteFileShareRequest.getFileShareARN() != null) {
        jsonGenerator
            .writeFieldName("FileShareARN")
            .writeValue(deleteFileShareRequest.getFileShareARN());
      }

      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<DescribeNFSFileSharesRequest> marshall(
      DescribeNFSFileSharesRequest describeNFSFileSharesRequest) {

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

    Request<DescribeNFSFileSharesRequest> request =
        new DefaultRequest<DescribeNFSFileSharesRequest>(
            describeNFSFileSharesRequest, "AWSStorageGateway");
    request.addHeader("X-Amz-Target", "StorageGateway_20130630.DescribeNFSFileShares");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<String> fileShareARNListList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeNFSFileSharesRequest.getFileShareARNList();
      if (!fileShareARNListList.isEmpty() || !fileShareARNListList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("FileShareARNList");
        jsonGenerator.writeStartArray();
        for (String fileShareARNListListValue : fileShareARNListList) {
          if (fileShareARNListListValue != null) {
            jsonGenerator.writeValue(fileShareARNListListValue);
          }
        }
        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;
  }
  public Request<CreateSnapshotRequest> marshall(CreateSnapshotRequest createSnapshotRequest) {

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

    Request<CreateSnapshotRequest> request =
        new DefaultRequest<CreateSnapshotRequest>(createSnapshotRequest, "AWSStorageGateway");
    request.addHeader("X-Amz-Target", "StorageGateway_20130630.CreateSnapshot");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator =
          SdkJsonProtocolFactory.createWriter(false, "1.1");

      jsonGenerator.writeStartObject();

      if (createSnapshotRequest.getVolumeARN() != null) {
        jsonGenerator.writeFieldName("VolumeARN").writeValue(createSnapshotRequest.getVolumeARN());
      }
      if (createSnapshotRequest.getSnapshotDescription() != null) {
        jsonGenerator
            .writeFieldName("SnapshotDescription")
            .writeValue(createSnapshotRequest.getSnapshotDescription());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", jsonGenerator.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }