/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( UpdateProvisioningParameter updateProvisioningParameter, StructuredJsonGenerator jsonGenerator) { if (updateProvisioningParameter == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (updateProvisioningParameter.getKey() != null) { jsonGenerator.writeFieldName("Key").writeValue(updateProvisioningParameter.getKey()); } if (updateProvisioningParameter.getValue() != null) { jsonGenerator.writeFieldName("Value").writeValue(updateProvisioningParameter.getValue()); } if (updateProvisioningParameter.getUsePreviousValue() != null) { jsonGenerator .writeFieldName("UsePreviousValue") .writeValue(updateProvisioningParameter.getUsePreviousValue()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<TerminateProvisionedProductRequest> marshall( TerminateProvisionedProductRequest terminateProvisionedProductRequest) { if (terminateProvisionedProductRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<TerminateProvisionedProductRequest> request = new DefaultRequest<TerminateProvisionedProductRequest>( terminateProvisionedProductRequest, "AWSServiceCatalog"); request.addHeader("X-Amz-Target", "AWS242ServiceCatalogService.TerminateProvisionedProduct"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (terminateProvisionedProductRequest.getProvisionedProductName() != null) { jsonGenerator .writeFieldName("ProvisionedProductName") .writeValue(terminateProvisionedProductRequest.getProvisionedProductName()); } if (terminateProvisionedProductRequest.getProvisionedProductId() != null) { jsonGenerator .writeFieldName("ProvisionedProductId") .writeValue(terminateProvisionedProductRequest.getProvisionedProductId()); } jsonGenerator .writeFieldName("TerminateToken") .writeValue( IdempotentUtils.resolveString( terminateProvisionedProductRequest.getTerminateToken())); if (terminateProvisionedProductRequest.getIgnoreErrors() != null) { jsonGenerator .writeFieldName("IgnoreErrors") .writeValue(terminateProvisionedProductRequest.getIgnoreErrors()); } if (terminateProvisionedProductRequest.getAcceptLanguage() != null) { jsonGenerator .writeFieldName("AcceptLanguage") .writeValue(terminateProvisionedProductRequest.getAcceptLanguage()); } 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<DescribeProvisioningParametersRequest> marshall( DescribeProvisioningParametersRequest describeProvisioningParametersRequest) { if (describeProvisioningParametersRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeProvisioningParametersRequest> request = new DefaultRequest<DescribeProvisioningParametersRequest>( describeProvisioningParametersRequest, "AWSServiceCatalog"); request.addHeader("X-Amz-Target", "AWS242ServiceCatalogService.DescribeProvisioningParameters"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (describeProvisioningParametersRequest.getAcceptLanguage() != null) { jsonGenerator .writeFieldName("AcceptLanguage") .writeValue(describeProvisioningParametersRequest.getAcceptLanguage()); } if (describeProvisioningParametersRequest.getProductId() != null) { jsonGenerator .writeFieldName("ProductId") .writeValue(describeProvisioningParametersRequest.getProductId()); } if (describeProvisioningParametersRequest.getProvisioningArtifactId() != null) { jsonGenerator .writeFieldName("ProvisioningArtifactId") .writeValue(describeProvisioningParametersRequest.getProvisioningArtifactId()); } if (describeProvisioningParametersRequest.getPathId() != null) { jsonGenerator .writeFieldName("PathId") .writeValue(describeProvisioningParametersRequest.getPathId()); } 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; }