public Request<DeleteAssociationRequest> marshall( DeleteAssociationRequest deleteAssociationRequest) { if (deleteAssociationRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteAssociationRequest> request = new DefaultRequest<DeleteAssociationRequest>( deleteAssociationRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.DeleteAssociation"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (deleteAssociationRequest.getName() != null) { jsonGenerator.writeFieldName("Name").writeValue(deleteAssociationRequest.getName()); } if (deleteAssociationRequest.getInstanceId() != null) { jsonGenerator .writeFieldName("InstanceId") .writeValue(deleteAssociationRequest.getInstanceId()); } 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 AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<ListCommandInvocationsRequest> marshall( ListCommandInvocationsRequest listCommandInvocationsRequest) { if (listCommandInvocationsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListCommandInvocationsRequest> request = new DefaultRequest<ListCommandInvocationsRequest>( listCommandInvocationsRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.ListCommandInvocations"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (listCommandInvocationsRequest.getCommandId() != null) { jsonGenerator .writeFieldName("CommandId") .writeValue(listCommandInvocationsRequest.getCommandId()); } if (listCommandInvocationsRequest.getInstanceId() != null) { jsonGenerator .writeFieldName("InstanceId") .writeValue(listCommandInvocationsRequest.getInstanceId()); } if (listCommandInvocationsRequest.getMaxResults() != null) { jsonGenerator .writeFieldName("MaxResults") .writeValue(listCommandInvocationsRequest.getMaxResults()); } if (listCommandInvocationsRequest.getNextToken() != null) { jsonGenerator .writeFieldName("NextToken") .writeValue(listCommandInvocationsRequest.getNextToken()); } com.amazonaws.internal.SdkInternalList<CommandFilter> filtersList = (com.amazonaws.internal.SdkInternalList<CommandFilter>) listCommandInvocationsRequest.getFilters(); if (!filtersList.isEmpty() || !filtersList.isAutoConstruct()) { jsonGenerator.writeFieldName("Filters"); jsonGenerator.writeStartArray(); for (CommandFilter filtersListValue : filtersList) { if (filtersListValue != null) { CommandFilterJsonMarshaller.getInstance().marshall(filtersListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (listCommandInvocationsRequest.getDetails() != null) { jsonGenerator .writeFieldName("Details") .writeValue(listCommandInvocationsRequest.getDetails()); } 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; }