public Request<DescribeConfigurationRecordersRequest> marshall( DescribeConfigurationRecordersRequest describeConfigurationRecordersRequest) { if (describeConfigurationRecordersRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeConfigurationRecordersRequest> request = new DefaultRequest<DescribeConfigurationRecordersRequest>( describeConfigurationRecordersRequest, "AmazonConfig"); request.addHeader("X-Amz-Target", "StarlingDoveService.DescribeConfigurationRecorders"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<String> configurationRecorderNamesList = (com.amazonaws.internal.SdkInternalList<String>) describeConfigurationRecordersRequest.getConfigurationRecorderNames(); if (!configurationRecorderNamesList.isEmpty() || !configurationRecorderNamesList.isAutoConstruct()) { jsonGenerator.writeFieldName("ConfigurationRecorderNames"); jsonGenerator.writeStartArray(); for (String configurationRecorderNamesListValue : configurationRecorderNamesList) { if (configurationRecorderNamesListValue != null) { jsonGenerator.writeValue(configurationRecorderNamesListValue); } } 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", protocolFactory.getContentType()); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<DeleteDeliveryChannelRequest> marshall( DeleteDeliveryChannelRequest deleteDeliveryChannelRequest) { if (deleteDeliveryChannelRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteDeliveryChannelRequest> request = new DefaultRequest<DeleteDeliveryChannelRequest>( deleteDeliveryChannelRequest, "AmazonConfig"); request.addHeader("X-Amz-Target", "StarlingDoveService.DeleteDeliveryChannel"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (deleteDeliveryChannelRequest.getDeliveryChannelName() != null) { jsonGenerator .writeFieldName("DeliveryChannelName") .writeValue(deleteDeliveryChannelRequest.getDeliveryChannelName()); } 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; }