public Request<ListOnPremisesInstancesRequest> marshall( ListOnPremisesInstancesRequest listOnPremisesInstancesRequest) { if (listOnPremisesInstancesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListOnPremisesInstancesRequest> request = new DefaultRequest<ListOnPremisesInstancesRequest>( listOnPremisesInstancesRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.ListOnPremisesInstances"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (listOnPremisesInstancesRequest.getRegistrationStatus() != null) { jsonGenerator .writeFieldName("registrationStatus") .writeValue(listOnPremisesInstancesRequest.getRegistrationStatus()); } com.amazonaws.internal.SdkInternalList<TagFilter> tagFiltersList = (com.amazonaws.internal.SdkInternalList<TagFilter>) listOnPremisesInstancesRequest.getTagFilters(); if (!tagFiltersList.isEmpty() || !tagFiltersList.isAutoConstruct()) { jsonGenerator.writeFieldName("tagFilters"); jsonGenerator.writeStartArray(); for (TagFilter tagFiltersListValue : tagFiltersList) { if (tagFiltersListValue != null) { TagFilterJsonMarshaller.getInstance().marshall(tagFiltersListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (listOnPremisesInstancesRequest.getNextToken() != null) { jsonGenerator .writeFieldName("nextToken") .writeValue(listOnPremisesInstancesRequest.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; }
public Request<RegisterOnPremisesInstanceRequest> marshall( RegisterOnPremisesInstanceRequest registerOnPremisesInstanceRequest) { if (registerOnPremisesInstanceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<RegisterOnPremisesInstanceRequest> request = new DefaultRequest<RegisterOnPremisesInstanceRequest>( registerOnPremisesInstanceRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.RegisterOnPremisesInstance"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (registerOnPremisesInstanceRequest.getInstanceName() != null) { jsonGenerator .writeFieldName("instanceName") .writeValue(registerOnPremisesInstanceRequest.getInstanceName()); } if (registerOnPremisesInstanceRequest.getIamUserArn() != null) { jsonGenerator .writeFieldName("iamUserArn") .writeValue(registerOnPremisesInstanceRequest.getIamUserArn()); } 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; }