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<ListTagsForResourceRequest> marshall( ListTagsForResourceRequest listTagsForResourceRequest) { if (listTagsForResourceRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListTagsForResourceRequest> request = new DefaultRequest<ListTagsForResourceRequest>( listTagsForResourceRequest, "AWSStorageGateway"); request.addHeader("X-Amz-Target", "StorageGateway_20130630.ListTagsForResource"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (listTagsForResourceRequest.getResourceARN() != null) { jsonGenerator .writeFieldName("ResourceARN") .writeValue(listTagsForResourceRequest.getResourceARN()); } if (listTagsForResourceRequest.getMarker() != null) { jsonGenerator.writeFieldName("Marker").writeValue(listTagsForResourceRequest.getMarker()); } if (listTagsForResourceRequest.getLimit() != null) { jsonGenerator.writeFieldName("Limit").writeValue(listTagsForResourceRequest.getLimit()); } 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; }
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; }
/** 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); } }