public Request<DeleteDeploymentConfigRequest> marshall( DeleteDeploymentConfigRequest deleteDeploymentConfigRequest) { if (deleteDeploymentConfigRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteDeploymentConfigRequest> request = new DefaultRequest<DeleteDeploymentConfigRequest>( deleteDeploymentConfigRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.DeleteDeploymentConfig"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (deleteDeploymentConfigRequest.getDeploymentConfigName() != null) { jsonWriter .key("deploymentConfigName") .value(deleteDeploymentConfigRequest.getDeploymentConfigName()); } 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; }
public Request<DeleteDeploymentConfigRequest> marshall( DeleteDeploymentConfigRequest deleteDeploymentConfigRequest) { if (deleteDeploymentConfigRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteDeploymentConfigRequest> request = new DefaultRequest<DeleteDeploymentConfigRequest>( deleteDeploymentConfigRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.DeleteDeploymentConfig"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (deleteDeploymentConfigRequest.getDeploymentConfigName() != null) { jsonGenerator .writeFieldName("deploymentConfigName") .writeValue(deleteDeploymentConfigRequest.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; }