public Request<UpdateAssociationStatusRequest> marshall( UpdateAssociationStatusRequest updateAssociationStatusRequest) { if (updateAssociationStatusRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateAssociationStatusRequest> request = new DefaultRequest<UpdateAssociationStatusRequest>( updateAssociationStatusRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.UpdateAssociationStatus"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (updateAssociationStatusRequest.getName() != null) { jsonWriter.key("Name").value(updateAssociationStatusRequest.getName()); } if (updateAssociationStatusRequest.getInstanceId() != null) { jsonWriter.key("InstanceId").value(updateAssociationStatusRequest.getInstanceId()); } if (updateAssociationStatusRequest.getAssociationStatus() != null) { jsonWriter.key("AssociationStatus"); AssociationStatusJsonMarshaller.getInstance() .marshall(updateAssociationStatusRequest.getAssociationStatus(), jsonWriter); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes(UTF8); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", "application/x-amz-json-1.1"); } 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 JSONWriter */ public void marshall(InstanceInformation instanceInformation, JSONWriter jsonWriter) { if (instanceInformation == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (instanceInformation.getInstanceId() != null) { jsonWriter.key("InstanceId").value(instanceInformation.getInstanceId()); } if (instanceInformation.getPingStatus() != null) { jsonWriter.key("PingStatus").value(instanceInformation.getPingStatus()); } if (instanceInformation.getLastPingDateTime() != null) { jsonWriter.key("LastPingDateTime").value(instanceInformation.getLastPingDateTime()); } if (instanceInformation.getAgentVersion() != null) { jsonWriter.key("AgentVersion").value(instanceInformation.getAgentVersion()); } if (instanceInformation.getIsLatestVersion() != null) { jsonWriter.key("IsLatestVersion").value(instanceInformation.getIsLatestVersion()); } if (instanceInformation.getPlatformType() != null) { jsonWriter.key("PlatformType").value(instanceInformation.getPlatformType()); } if (instanceInformation.getPlatformName() != null) { jsonWriter.key("PlatformName").value(instanceInformation.getPlatformName()); } if (instanceInformation.getPlatformVersion() != null) { jsonWriter.key("PlatformVersion").value(instanceInformation.getPlatformVersion()); } jsonWriter.endObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<DescribeInstanceInformationRequest> marshall( DescribeInstanceInformationRequest describeInstanceInformationRequest) { if (describeInstanceInformationRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeInstanceInformationRequest> request = new DefaultRequest<DescribeInstanceInformationRequest>( describeInstanceInformationRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.DescribeInstanceInformation"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); com.amazonaws.internal.SdkInternalList<InstanceInformationFilter> instanceInformationFilterListList = (com.amazonaws.internal.SdkInternalList<InstanceInformationFilter>) describeInstanceInformationRequest.getInstanceInformationFilterList(); if (!instanceInformationFilterListList.isEmpty() || !instanceInformationFilterListList.isAutoConstruct()) { jsonWriter.key("InstanceInformationFilterList"); jsonWriter.array(); for (InstanceInformationFilter instanceInformationFilterListListValue : instanceInformationFilterListList) { if (instanceInformationFilterListListValue != null) { InstanceInformationFilterJsonMarshaller.getInstance() .marshall(instanceInformationFilterListListValue, jsonWriter); } } jsonWriter.endArray(); } if (describeInstanceInformationRequest.getMaxResults() != null) { jsonWriter.key("MaxResults").value(describeInstanceInformationRequest.getMaxResults()); } if (describeInstanceInformationRequest.getNextToken() != null) { jsonWriter.key("NextToken").value(describeInstanceInformationRequest.getNextToken()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes(UTF8); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", "application/x-amz-json-1.1"); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }