/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( MaintenanceWindowFilter maintenanceWindowFilter, StructuredJsonGenerator jsonGenerator) { if (maintenanceWindowFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (maintenanceWindowFilter.getKey() != null) { jsonGenerator.writeFieldName("Key").writeValue(maintenanceWindowFilter.getKey()); } com.amazonaws.internal.SdkInternalList<String> valuesList = (com.amazonaws.internal.SdkInternalList<String>) maintenanceWindowFilter.getValues(); if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) { jsonGenerator.writeFieldName("Values"); jsonGenerator.writeStartArray(); for (String valuesListValue : valuesList) { if (valuesListValue != null) { jsonGenerator.writeValue(valuesListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<ListDocumentsRequest> marshall(ListDocumentsRequest listDocumentsRequest) { if (listDocumentsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListDocumentsRequest> request = new DefaultRequest<ListDocumentsRequest>( listDocumentsRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.ListDocuments"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<DocumentFilter> documentFilterListList = (com.amazonaws.internal.SdkInternalList<DocumentFilter>) listDocumentsRequest.getDocumentFilterList(); if (!documentFilterListList.isEmpty() || !documentFilterListList.isAutoConstruct()) { jsonGenerator.writeFieldName("DocumentFilterList"); jsonGenerator.writeStartArray(); for (DocumentFilter documentFilterListListValue : documentFilterListList) { if (documentFilterListListValue != null) { DocumentFilterJsonMarshaller.getInstance() .marshall(documentFilterListListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (listDocumentsRequest.getMaxResults() != null) { jsonGenerator.writeFieldName("MaxResults").writeValue(listDocumentsRequest.getMaxResults()); } if (listDocumentsRequest.getNextToken() != null) { jsonGenerator.writeFieldName("NextToken").writeValue(listDocumentsRequest.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; }