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; }
/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(Scope scope, JSONWriter jsonWriter) { if (scope == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); com.amazonaws.internal.SdkInternalList<String> complianceResourceTypesList = (com.amazonaws.internal.SdkInternalList<String>) scope.getComplianceResourceTypes(); if (!complianceResourceTypesList.isEmpty() || !complianceResourceTypesList.isAutoConstruct()) { jsonWriter.key("ComplianceResourceTypes"); jsonWriter.array(); for (String complianceResourceTypesListValue : complianceResourceTypesList) { if (complianceResourceTypesListValue != null) { jsonWriter.value(complianceResourceTypesListValue); } } jsonWriter.endArray(); } if (scope.getTagKey() != null) { jsonWriter.key("TagKey").value(scope.getTagKey()); } if (scope.getTagValue() != null) { jsonWriter.key("TagValue").value(scope.getTagValue()); } if (scope.getComplianceResourceId() != null) { jsonWriter.key("ComplianceResourceId").value(scope.getComplianceResourceId()); } jsonWriter.endObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }