public Request<GetDeploymentConfigRequest> marshall( GetDeploymentConfigRequest getDeploymentConfigRequest) { if (getDeploymentConfigRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<GetDeploymentConfigRequest> request = new DefaultRequest<GetDeploymentConfigRequest>( getDeploymentConfigRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.GetDeploymentConfig"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (getDeploymentConfigRequest.getDeploymentConfigName() != null) { jsonGenerator .writeFieldName("deploymentConfigName") .writeValue(getDeploymentConfigRequest.getDeploymentConfigName()); } 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<RemoveTagsFromOnPremisesInstancesRequest> marshall( RemoveTagsFromOnPremisesInstancesRequest removeTagsFromOnPremisesInstancesRequest) { if (removeTagsFromOnPremisesInstancesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<RemoveTagsFromOnPremisesInstancesRequest> request = new DefaultRequest<RemoveTagsFromOnPremisesInstancesRequest>( removeTagsFromOnPremisesInstancesRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.RemoveTagsFromOnPremisesInstances"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<Tag> tagsList = (com.amazonaws.internal.SdkInternalList<Tag>) removeTagsFromOnPremisesInstancesRequest.getTags(); if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) { jsonGenerator.writeFieldName("tags"); jsonGenerator.writeStartArray(); for (Tag tagsListValue : tagsList) { if (tagsListValue != null) { TagJsonMarshaller.getInstance().marshall(tagsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } com.amazonaws.internal.SdkInternalList<String> instanceNamesList = (com.amazonaws.internal.SdkInternalList<String>) removeTagsFromOnPremisesInstancesRequest.getInstanceNames(); if (!instanceNamesList.isEmpty() || !instanceNamesList.isAutoConstruct()) { jsonGenerator.writeFieldName("instanceNames"); jsonGenerator.writeStartArray(); for (String instanceNamesListValue : instanceNamesList) { if (instanceNamesListValue != null) { jsonGenerator.writeValue(instanceNamesListValue); } } 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", jsonGenerator.getContentType()); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }