public Request<DeleteTagsRequest> marshall(DeleteTagsRequest deleteTagsRequest) { if (deleteTagsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteTagsRequest> request = new DefaultRequest<DeleteTagsRequest>(deleteTagsRequest, "AWSApplicationDiscovery"); request.addHeader("X-Amz-Target", "AWSPoseidonService_V2015_11_01.DeleteTags"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); java.util.List<String> configurationIdsList = deleteTagsRequest.getConfigurationIds(); if (configurationIdsList != null) { jsonGenerator.writeFieldName("configurationIds"); jsonGenerator.writeStartArray(); for (String configurationIdsListValue : configurationIdsList) { if (configurationIdsListValue != null) { jsonGenerator.writeValue(configurationIdsListValue); } } jsonGenerator.writeEndArray(); } java.util.List<Tag> tagsList = deleteTagsRequest.getTags(); if (tagsList != null) { jsonGenerator.writeFieldName("tags"); jsonGenerator.writeStartArray(); for (Tag tagsListValue : tagsList) { if (tagsListValue != null) { TagJsonMarshaller.getInstance().marshall(tagsListValue, jsonGenerator); } } 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; }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( HadoopJarStepConfig hadoopJarStepConfig, StructuredJsonGenerator jsonGenerator) { if (hadoopJarStepConfig == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<KeyValue> propertiesList = (com.amazonaws.internal.SdkInternalList<KeyValue>) hadoopJarStepConfig.getProperties(); if (!propertiesList.isEmpty() || !propertiesList.isAutoConstruct()) { jsonGenerator.writeFieldName("Properties"); jsonGenerator.writeStartArray(); for (KeyValue propertiesListValue : propertiesList) { if (propertiesListValue != null) { KeyValueJsonMarshaller.getInstance().marshall(propertiesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (hadoopJarStepConfig.getJar() != null) { jsonGenerator.writeFieldName("Jar").writeValue(hadoopJarStepConfig.getJar()); } if (hadoopJarStepConfig.getMainClass() != null) { jsonGenerator.writeFieldName("MainClass").writeValue(hadoopJarStepConfig.getMainClass()); } com.amazonaws.internal.SdkInternalList<String> argsList = (com.amazonaws.internal.SdkInternalList<String>) hadoopJarStepConfig.getArgs(); if (!argsList.isEmpty() || !argsList.isAutoConstruct()) { jsonGenerator.writeFieldName("Args"); jsonGenerator.writeStartArray(); for (String argsListValue : argsList) { if (argsListValue != null) { jsonGenerator.writeValue(argsListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<LookupEventsRequest> marshall(LookupEventsRequest lookupEventsRequest) { if (lookupEventsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<LookupEventsRequest> request = new DefaultRequest<LookupEventsRequest>(lookupEventsRequest, "AWSCloudTrail"); request.addHeader( "X-Amz-Target", "com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.LookupEvents"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<LookupAttribute> lookupAttributesList = (com.amazonaws.internal.SdkInternalList<LookupAttribute>) lookupEventsRequest.getLookupAttributes(); if (!lookupAttributesList.isEmpty() || !lookupAttributesList.isAutoConstruct()) { jsonGenerator.writeFieldName("LookupAttributes"); jsonGenerator.writeStartArray(); for (LookupAttribute lookupAttributesListValue : lookupAttributesList) { if (lookupAttributesListValue != null) { LookupAttributeJsonMarshaller.getInstance() .marshall(lookupAttributesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (lookupEventsRequest.getStartTime() != null) { jsonGenerator.writeFieldName("StartTime").writeValue(lookupEventsRequest.getStartTime()); } if (lookupEventsRequest.getEndTime() != null) { jsonGenerator.writeFieldName("EndTime").writeValue(lookupEventsRequest.getEndTime()); } if (lookupEventsRequest.getMaxResults() != null) { jsonGenerator.writeFieldName("MaxResults").writeValue(lookupEventsRequest.getMaxResults()); } if (lookupEventsRequest.getNextToken() != null) { jsonGenerator.writeFieldName("NextToken").writeValue(lookupEventsRequest.getNextToken()); } 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 SdkJsonGenerator */ public void marshall(IPSet iPSet, StructuredJsonGenerator jsonGenerator) { if (iPSet == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (iPSet.getIPSetId() != null) { jsonGenerator.writeFieldName("IPSetId").writeValue(iPSet.getIPSetId()); } if (iPSet.getName() != null) { jsonGenerator.writeFieldName("Name").writeValue(iPSet.getName()); } java.util.List<IPSetDescriptor> iPSetDescriptorsList = iPSet.getIPSetDescriptors(); if (iPSetDescriptorsList != null) { jsonGenerator.writeFieldName("IPSetDescriptors"); jsonGenerator.writeStartArray(); for (IPSetDescriptor iPSetDescriptorsListValue : iPSetDescriptorsList) { if (iPSetDescriptorsListValue != null) { IPSetDescriptorJsonMarshaller.getInstance() .marshall(iPSetDescriptorsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(TaskOverride taskOverride, StructuredJsonGenerator jsonGenerator) { if (taskOverride == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<ContainerOverride> containerOverridesList = (com.amazonaws.internal.SdkInternalList<ContainerOverride>) taskOverride.getContainerOverrides(); if (!containerOverridesList.isEmpty() || !containerOverridesList.isAutoConstruct()) { jsonGenerator.writeFieldName("containerOverrides"); jsonGenerator.writeStartArray(); for (ContainerOverride containerOverridesListValue : containerOverridesList) { if (containerOverridesListValue != null) { ContainerOverrideJsonMarshaller.getInstance() .marshall(containerOverridesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( DirectoryVpcSettings directoryVpcSettings, StructuredJsonGenerator jsonGenerator) { if (directoryVpcSettings == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (directoryVpcSettings.getVpcId() != null) { jsonGenerator.writeFieldName("VpcId").writeValue(directoryVpcSettings.getVpcId()); } com.amazonaws.internal.SdkInternalList<String> subnetIdsList = (com.amazonaws.internal.SdkInternalList<String>) directoryVpcSettings.getSubnetIds(); if (!subnetIdsList.isEmpty() || !subnetIdsList.isAutoConstruct()) { jsonGenerator.writeFieldName("SubnetIds"); jsonGenerator.writeStartArray(); for (String subnetIdsListValue : subnetIdsList) { if (subnetIdsListValue != null) { jsonGenerator.writeValue(subnetIdsListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( VaultNotificationConfig vaultNotificationConfig, StructuredJsonGenerator jsonGenerator) { if (vaultNotificationConfig == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (vaultNotificationConfig.getSNSTopic() != null) { jsonGenerator.writeFieldName("SNSTopic").writeValue(vaultNotificationConfig.getSNSTopic()); } java.util.List<String> eventsList = vaultNotificationConfig.getEvents(); if (eventsList != null) { jsonGenerator.writeFieldName("Events"); jsonGenerator.writeStartArray(); for (String eventsListValue : eventsList) { if (eventsListValue != null) { jsonGenerator.writeValue(eventsListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( MaintenanceWindowFilter maintenanceWindowFilter, StructuredJsonGenerator jsonGenerator) { if (maintenanceWindowFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (maintenanceWindowFilter.getKey() != null) { jsonGenerator.writeFieldName("Key").writeValue(maintenanceWindowFilter.getKey()); } com.amazonaws.internal.SdkInternalList<String> valuesList = (com.amazonaws.internal.SdkInternalList<String>) maintenanceWindowFilter.getValues(); if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) { jsonGenerator.writeFieldName("Values"); jsonGenerator.writeStartArray(); for (String valuesListValue : valuesList) { if (valuesListValue != null) { jsonGenerator.writeValue(valuesListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(UniqueProblem uniqueProblem, StructuredJsonGenerator jsonGenerator) { if (uniqueProblem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (uniqueProblem.getMessage() != null) { jsonGenerator.writeFieldName("message").writeValue(uniqueProblem.getMessage()); } java.util.List<Problem> problemsList = uniqueProblem.getProblems(); if (problemsList != null) { jsonGenerator.writeFieldName("problems"); jsonGenerator.writeStartArray(); for (Problem problemsListValue : problemsList) { if (problemsListValue != null) { ProblemJsonMarshaller.getInstance().marshall(problemsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( AutoScalingThresholds autoScalingThresholds, StructuredJsonGenerator jsonGenerator) { if (autoScalingThresholds == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (autoScalingThresholds.getInstanceCount() != null) { jsonGenerator .writeFieldName("InstanceCount") .writeValue(autoScalingThresholds.getInstanceCount()); } if (autoScalingThresholds.getThresholdsWaitTime() != null) { jsonGenerator .writeFieldName("ThresholdsWaitTime") .writeValue(autoScalingThresholds.getThresholdsWaitTime()); } if (autoScalingThresholds.getIgnoreMetricsTime() != null) { jsonGenerator .writeFieldName("IgnoreMetricsTime") .writeValue(autoScalingThresholds.getIgnoreMetricsTime()); } if (autoScalingThresholds.getCpuThreshold() != null) { jsonGenerator .writeFieldName("CpuThreshold") .writeValue(autoScalingThresholds.getCpuThreshold()); } if (autoScalingThresholds.getMemoryThreshold() != null) { jsonGenerator .writeFieldName("MemoryThreshold") .writeValue(autoScalingThresholds.getMemoryThreshold()); } if (autoScalingThresholds.getLoadThreshold() != null) { jsonGenerator .writeFieldName("LoadThreshold") .writeValue(autoScalingThresholds.getLoadThreshold()); } com.amazonaws.internal.SdkInternalList<String> alarmsList = (com.amazonaws.internal.SdkInternalList<String>) autoScalingThresholds.getAlarms(); if (!alarmsList.isEmpty() || !alarmsList.isAutoConstruct()) { jsonGenerator.writeFieldName("Alarms"); jsonGenerator.writeStartArray(); for (String alarmsListValue : alarmsList) { if (alarmsListValue != null) { jsonGenerator.writeValue(alarmsListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<ListOnPremisesInstancesRequest> marshall( ListOnPremisesInstancesRequest listOnPremisesInstancesRequest) { if (listOnPremisesInstancesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListOnPremisesInstancesRequest> request = new DefaultRequest<ListOnPremisesInstancesRequest>( listOnPremisesInstancesRequest, "AmazonCodeDeploy"); request.addHeader("X-Amz-Target", "CodeDeploy_20141006.ListOnPremisesInstances"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (listOnPremisesInstancesRequest.getRegistrationStatus() != null) { jsonGenerator .writeFieldName("registrationStatus") .writeValue(listOnPremisesInstancesRequest.getRegistrationStatus()); } com.amazonaws.internal.SdkInternalList<TagFilter> tagFiltersList = (com.amazonaws.internal.SdkInternalList<TagFilter>) listOnPremisesInstancesRequest.getTagFilters(); if (!tagFiltersList.isEmpty() || !tagFiltersList.isAutoConstruct()) { jsonGenerator.writeFieldName("tagFilters"); jsonGenerator.writeStartArray(); for (TagFilter tagFiltersListValue : tagFiltersList) { if (tagFiltersListValue != null) { TagFilterJsonMarshaller.getInstance().marshall(tagFiltersListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (listOnPremisesInstancesRequest.getNextToken() != null) { jsonGenerator .writeFieldName("nextToken") .writeValue(listOnPremisesInstancesRequest.getNextToken()); } 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<CreateConditionalForwarderRequest> marshall( CreateConditionalForwarderRequest createConditionalForwarderRequest) { if (createConditionalForwarderRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateConditionalForwarderRequest> request = new DefaultRequest<CreateConditionalForwarderRequest>( createConditionalForwarderRequest, "AWSDirectoryService"); request.addHeader("X-Amz-Target", "DirectoryService_20150416.CreateConditionalForwarder"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (createConditionalForwarderRequest.getDirectoryId() != null) { jsonGenerator .writeFieldName("DirectoryId") .writeValue(createConditionalForwarderRequest.getDirectoryId()); } if (createConditionalForwarderRequest.getRemoteDomainName() != null) { jsonGenerator .writeFieldName("RemoteDomainName") .writeValue(createConditionalForwarderRequest.getRemoteDomainName()); } com.amazonaws.internal.SdkInternalList<String> dnsIpAddrsList = (com.amazonaws.internal.SdkInternalList<String>) createConditionalForwarderRequest.getDnsIpAddrs(); if (!dnsIpAddrsList.isEmpty() || !dnsIpAddrsList.isAutoConstruct()) { jsonGenerator.writeFieldName("DnsIpAddrs"); jsonGenerator.writeStartArray(); for (String dnsIpAddrsListValue : dnsIpAddrsList) { if (dnsIpAddrsListValue != null) { jsonGenerator.writeValue(dnsIpAddrsListValue); } } 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; }
public Request<ListClustersRequest> marshall(ListClustersRequest listClustersRequest) { if (listClustersRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListClustersRequest> request = new DefaultRequest<ListClustersRequest>(listClustersRequest, "AmazonElasticMapReduce"); request.addHeader("X-Amz-Target", "ElasticMapReduce.ListClusters"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (listClustersRequest.getCreatedAfter() != null) { jsonGenerator .writeFieldName("CreatedAfter") .writeValue(listClustersRequest.getCreatedAfter()); } if (listClustersRequest.getCreatedBefore() != null) { jsonGenerator .writeFieldName("CreatedBefore") .writeValue(listClustersRequest.getCreatedBefore()); } com.amazonaws.internal.SdkInternalList<String> clusterStatesList = (com.amazonaws.internal.SdkInternalList<String>) listClustersRequest.getClusterStates(); if (!clusterStatesList.isEmpty() || !clusterStatesList.isAutoConstruct()) { jsonGenerator.writeFieldName("ClusterStates"); jsonGenerator.writeStartArray(); for (String clusterStatesListValue : clusterStatesList) { if (clusterStatesListValue != null) { jsonGenerator.writeValue(clusterStatesListValue); } } jsonGenerator.writeEndArray(); } if (listClustersRequest.getMarker() != null) { jsonGenerator.writeFieldName("Marker").writeValue(listClustersRequest.getMarker()); } 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; }
public Request<RespondDecisionTaskCompletedRequest> marshall( RespondDecisionTaskCompletedRequest respondDecisionTaskCompletedRequest) { if (respondDecisionTaskCompletedRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<RespondDecisionTaskCompletedRequest> request = new DefaultRequest<RespondDecisionTaskCompletedRequest>( respondDecisionTaskCompletedRequest, "AmazonSimpleWorkflow"); request.addHeader("X-Amz-Target", "SimpleWorkflowService.RespondDecisionTaskCompleted"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (respondDecisionTaskCompletedRequest.getTaskToken() != null) { jsonGenerator .writeFieldName("taskToken") .writeValue(respondDecisionTaskCompletedRequest.getTaskToken()); } java.util.List<Decision> decisionsList = respondDecisionTaskCompletedRequest.getDecisions(); if (decisionsList != null) { jsonGenerator.writeFieldName("decisions"); jsonGenerator.writeStartArray(); for (Decision decisionsListValue : decisionsList) { if (decisionsListValue != null) { DecisionJsonMarshaller.getInstance().marshall(decisionsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (respondDecisionTaskCompletedRequest.getExecutionContext() != null) { jsonGenerator .writeFieldName("executionContext") .writeValue(respondDecisionTaskCompletedRequest.getExecutionContext()); } 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<UpdateByteMatchSetRequest> marshall( UpdateByteMatchSetRequest updateByteMatchSetRequest) { if (updateByteMatchSetRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateByteMatchSetRequest> request = new DefaultRequest<UpdateByteMatchSetRequest>(updateByteMatchSetRequest, "AWSWAF"); request.addHeader("X-Amz-Target", "AWSWAF_20150824.UpdateByteMatchSet"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (updateByteMatchSetRequest.getByteMatchSetId() != null) { jsonGenerator .writeFieldName("ByteMatchSetId") .writeValue(updateByteMatchSetRequest.getByteMatchSetId()); } if (updateByteMatchSetRequest.getChangeToken() != null) { jsonGenerator .writeFieldName("ChangeToken") .writeValue(updateByteMatchSetRequest.getChangeToken()); } java.util.List<ByteMatchSetUpdate> updatesList = updateByteMatchSetRequest.getUpdates(); if (updatesList != null) { jsonGenerator.writeFieldName("Updates"); jsonGenerator.writeStartArray(); for (ByteMatchSetUpdate updatesListValue : updatesList) { if (updatesListValue != null) { ByteMatchSetUpdateJsonMarshaller.getInstance() .marshall(updatesListValue, jsonGenerator); } } 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<UpdateMethodRequest> marshall(UpdateMethodRequest updateMethodRequest) { if (updateMethodRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<UpdateMethodRequest> request = new DefaultRequest<UpdateMethodRequest>(updateMethodRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.PATCH); String uriResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "restapi_id", updateMethodRequest.getRestApiId()); uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "resource_id", updateMethodRequest.getResourceId()); uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "http_method", updateMethodRequest.getHttpMethod()); request.setResourcePath(uriResourcePath); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); java.util.List<PatchOperation> patchOperationsList = updateMethodRequest.getPatchOperations(); if (patchOperationsList != null) { jsonGenerator.writeFieldName("patchOperations"); jsonGenerator.writeStartArray(); for (PatchOperation patchOperationsListValue : patchOperationsList) { if (patchOperationsListValue != null) { PatchOperationJsonMarshaller.getInstance() .marshall(patchOperationsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
@Test public void complexArray() throws IOException { jsonGenerator.writeStartArray(); jsonGenerator.writeStartObject(); jsonGenerator.writeFieldName("nestedProp").writeValue("nestedVal"); jsonGenerator.writeEndObject(); jsonGenerator.writeEndArray(); JsonNode node = toJsonNode(); assertEquals("nestedVal", node.get(0).get("nestedProp").textValue()); }
public Request<DescribeRaidArraysRequest> marshall( DescribeRaidArraysRequest describeRaidArraysRequest) { if (describeRaidArraysRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DescribeRaidArraysRequest> request = new DefaultRequest<DescribeRaidArraysRequest>(describeRaidArraysRequest, "AWSOpsWorks"); request.addHeader("X-Amz-Target", "OpsWorks_20130218.DescribeRaidArrays"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (describeRaidArraysRequest.getInstanceId() != null) { jsonGenerator .writeFieldName("InstanceId") .writeValue(describeRaidArraysRequest.getInstanceId()); } if (describeRaidArraysRequest.getStackId() != null) { jsonGenerator.writeFieldName("StackId").writeValue(describeRaidArraysRequest.getStackId()); } com.amazonaws.internal.SdkInternalList<String> raidArrayIdsList = (com.amazonaws.internal.SdkInternalList<String>) describeRaidArraysRequest.getRaidArrayIds(); if (!raidArrayIdsList.isEmpty() || !raidArrayIdsList.isAutoConstruct()) { jsonGenerator.writeFieldName("RaidArrayIds"); jsonGenerator.writeStartArray(); for (String raidArrayIdsListValue : raidArrayIdsList) { if (raidArrayIdsListValue != null) { jsonGenerator.writeValue(raidArrayIdsListValue); } } 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 SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<ListDocumentsRequest> marshall(ListDocumentsRequest listDocumentsRequest) { if (listDocumentsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListDocumentsRequest> request = new DefaultRequest<ListDocumentsRequest>( listDocumentsRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.ListDocuments"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<DocumentFilter> documentFilterListList = (com.amazonaws.internal.SdkInternalList<DocumentFilter>) listDocumentsRequest.getDocumentFilterList(); if (!documentFilterListList.isEmpty() || !documentFilterListList.isAutoConstruct()) { jsonGenerator.writeFieldName("DocumentFilterList"); jsonGenerator.writeStartArray(); for (DocumentFilter documentFilterListListValue : documentFilterListList) { if (documentFilterListListValue != null) { DocumentFilterJsonMarshaller.getInstance() .marshall(documentFilterListListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (listDocumentsRequest.getMaxResults() != null) { jsonGenerator.writeFieldName("MaxResults").writeValue(listDocumentsRequest.getMaxResults()); } if (listDocumentsRequest.getNextToken() != null) { jsonGenerator.writeFieldName("NextToken").writeValue(listDocumentsRequest.getNextToken()); } 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<AddInstanceGroupsRequest> marshall( AddInstanceGroupsRequest addInstanceGroupsRequest) { if (addInstanceGroupsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<AddInstanceGroupsRequest> request = new DefaultRequest<AddInstanceGroupsRequest>( addInstanceGroupsRequest, "AmazonElasticMapReduce"); request.addHeader("X-Amz-Target", "ElasticMapReduce.AddInstanceGroups"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<InstanceGroupConfig> instanceGroupsList = (com.amazonaws.internal.SdkInternalList<InstanceGroupConfig>) addInstanceGroupsRequest.getInstanceGroups(); if (!instanceGroupsList.isEmpty() || !instanceGroupsList.isAutoConstruct()) { jsonGenerator.writeFieldName("InstanceGroups"); jsonGenerator.writeStartArray(); for (InstanceGroupConfig instanceGroupsListValue : instanceGroupsList) { if (instanceGroupsListValue != null) { InstanceGroupConfigJsonMarshaller.getInstance() .marshall(instanceGroupsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (addInstanceGroupsRequest.getJobFlowId() != null) { jsonGenerator .writeFieldName("JobFlowId") .writeValue(addInstanceGroupsRequest.getJobFlowId()); } 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; }
public Request<BatchGetImageRequest> marshall(BatchGetImageRequest batchGetImageRequest) { if (batchGetImageRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<BatchGetImageRequest> request = new DefaultRequest<BatchGetImageRequest>(batchGetImageRequest, "AmazonECR"); request.addHeader("X-Amz-Target", "AmazonEC2ContainerRegistry_V20150921.BatchGetImage"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (batchGetImageRequest.getRegistryId() != null) { jsonGenerator.writeFieldName("registryId").writeValue(batchGetImageRequest.getRegistryId()); } if (batchGetImageRequest.getRepositoryName() != null) { jsonGenerator .writeFieldName("repositoryName") .writeValue(batchGetImageRequest.getRepositoryName()); } java.util.List<ImageIdentifier> imageIdsList = batchGetImageRequest.getImageIds(); if (imageIdsList != null) { jsonGenerator.writeFieldName("imageIds"); jsonGenerator.writeStartArray(); for (ImageIdentifier imageIdsListValue : imageIdsList) { if (imageIdsListValue != null) { ImageIdentifierJsonMarshaller.getInstance().marshall(imageIdsListValue, jsonGenerator); } } 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 SdkJsonGenerator */ public void marshall( StepScalingPolicyConfiguration stepScalingPolicyConfiguration, StructuredJsonGenerator jsonGenerator) { if (stepScalingPolicyConfiguration == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (stepScalingPolicyConfiguration.getAdjustmentType() != null) { jsonGenerator .writeFieldName("AdjustmentType") .writeValue(stepScalingPolicyConfiguration.getAdjustmentType()); } java.util.List<StepAdjustment> stepAdjustmentsList = stepScalingPolicyConfiguration.getStepAdjustments(); if (stepAdjustmentsList != null) { jsonGenerator.writeFieldName("StepAdjustments"); jsonGenerator.writeStartArray(); for (StepAdjustment stepAdjustmentsListValue : stepAdjustmentsList) { if (stepAdjustmentsListValue != null) { StepAdjustmentJsonMarshaller.getInstance() .marshall(stepAdjustmentsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (stepScalingPolicyConfiguration.getMinAdjustmentMagnitude() != null) { jsonGenerator .writeFieldName("MinAdjustmentMagnitude") .writeValue(stepScalingPolicyConfiguration.getMinAdjustmentMagnitude()); } if (stepScalingPolicyConfiguration.getCooldown() != null) { jsonGenerator .writeFieldName("Cooldown") .writeValue(stepScalingPolicyConfiguration.getCooldown()); } if (stepScalingPolicyConfiguration.getMetricAggregationType() != null) { jsonGenerator .writeFieldName("MetricAggregationType") .writeValue(stepScalingPolicyConfiguration.getMetricAggregationType()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
@Test public void stringArray() throws IOException { jsonGenerator.writeStartArray(); jsonGenerator.writeValue("valOne"); jsonGenerator.writeValue("valTwo"); jsonGenerator.writeValue("valThree"); jsonGenerator.writeEndArray(); JsonNode node = toJsonNode(); assertTrue(node.isArray()); assertEquals("valOne", node.get(0).textValue()); assertEquals("valTwo", node.get(1).textValue()); assertEquals("valThree", node.get(2).textValue()); }
public Request<CreatePlayerSessionsRequest> marshall( CreatePlayerSessionsRequest createPlayerSessionsRequest) { if (createPlayerSessionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreatePlayerSessionsRequest> request = new DefaultRequest<CreatePlayerSessionsRequest>( createPlayerSessionsRequest, "AmazonGameLift"); request.addHeader("X-Amz-Target", "GameLift.CreatePlayerSessions"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (createPlayerSessionsRequest.getGameSessionId() != null) { jsonGenerator .writeFieldName("GameSessionId") .writeValue(createPlayerSessionsRequest.getGameSessionId()); } java.util.List<String> playerIdsList = createPlayerSessionsRequest.getPlayerIds(); if (playerIdsList != null) { jsonGenerator.writeFieldName("PlayerIds"); jsonGenerator.writeStartArray(); for (String playerIdsListValue : playerIdsList) { if (playerIdsListValue != null) { jsonGenerator.writeValue(playerIdsListValue); } } 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 SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<AddTagsRequest> marshall(AddTagsRequest addTagsRequest) { if (addTagsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<AddTagsRequest> request = new DefaultRequest<AddTagsRequest>(addTagsRequest, "AWSElasticsearch"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/2015-01-01/tags"; request.setResourcePath(uriResourcePath); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (addTagsRequest.getARN() != null) { jsonGenerator.writeFieldName("ARN").writeValue(addTagsRequest.getARN()); } java.util.List<Tag> tagListList = addTagsRequest.getTagList(); if (tagListList != null) { jsonGenerator.writeFieldName("TagList"); jsonGenerator.writeStartArray(); for (Tag tagListListValue : tagListList) { if (tagListListValue != null) { TagJsonMarshaller.getInstance().marshall(tagListListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); if (!request.getHeaders().containsKey("Content-Type")) { 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<DescribeRulesPackagesRequest> marshall( DescribeRulesPackagesRequest describeRulesPackagesRequest) { if (describeRulesPackagesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DescribeRulesPackagesRequest> request = new DefaultRequest<DescribeRulesPackagesRequest>( describeRulesPackagesRequest, "AmazonInspector"); request.addHeader("X-Amz-Target", "InspectorService.DescribeRulesPackages"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); java.util.List<String> rulesPackageArnsList = describeRulesPackagesRequest.getRulesPackageArns(); if (rulesPackageArnsList != null) { jsonGenerator.writeFieldName("rulesPackageArns"); jsonGenerator.writeStartArray(); for (String rulesPackageArnsListValue : rulesPackageArnsList) { if (rulesPackageArnsListValue != null) { jsonGenerator.writeValue(rulesPackageArnsListValue); } } jsonGenerator.writeEndArray(); } if (describeRulesPackagesRequest.getLocale() != null) { jsonGenerator.writeFieldName("locale").writeValue(describeRulesPackagesRequest.getLocale()); } 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<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<PutTraceSegmentsRequest> marshall( PutTraceSegmentsRequest putTraceSegmentsRequest) { if (putTraceSegmentsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<PutTraceSegmentsRequest> request = new DefaultRequest<PutTraceSegmentsRequest>(putTraceSegmentsRequest, "AWSXRay"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/TraceSegments"; request.setResourcePath(uriResourcePath); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); java.util.List<String> traceSegmentDocumentsList = putTraceSegmentsRequest.getTraceSegmentDocuments(); if (traceSegmentDocumentsList != null) { jsonGenerator.writeFieldName("TraceSegmentDocuments"); jsonGenerator.writeStartArray(); for (String traceSegmentDocumentsListValue : traceSegmentDocumentsList) { if (traceSegmentDocumentsListValue != null) { jsonGenerator.writeValue(traceSegmentDocumentsListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); if (!request.getHeaders().containsKey("Content-Type")) { 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<StopWorkspacesRequest> marshall(StopWorkspacesRequest stopWorkspacesRequest) { if (stopWorkspacesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<StopWorkspacesRequest> request = new DefaultRequest<StopWorkspacesRequest>(stopWorkspacesRequest, "AmazonWorkspaces"); request.addHeader("X-Amz-Target", "WorkspacesService.StopWorkspaces"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<StopRequest> stopWorkspaceRequestsList = (com.amazonaws.internal.SdkInternalList<StopRequest>) stopWorkspacesRequest.getStopWorkspaceRequests(); if (!stopWorkspaceRequestsList.isEmpty() || !stopWorkspaceRequestsList.isAutoConstruct()) { jsonGenerator.writeFieldName("StopWorkspaceRequests"); jsonGenerator.writeStartArray(); for (StopRequest stopWorkspaceRequestsListValue : stopWorkspaceRequestsList) { if (stopWorkspaceRequestsListValue != null) { StopRequestJsonMarshaller.getInstance() .marshall(stopWorkspaceRequestsListValue, jsonGenerator); } } 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 SdkJsonGenerator */ public void marshall( DevicePoolCompatibilityResult devicePoolCompatibilityResult, StructuredJsonGenerator jsonGenerator) { if (devicePoolCompatibilityResult == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (devicePoolCompatibilityResult.getDevice() != null) { jsonGenerator.writeFieldName("device"); DeviceJsonMarshaller.getInstance() .marshall(devicePoolCompatibilityResult.getDevice(), jsonGenerator); } if (devicePoolCompatibilityResult.getCompatible() != null) { jsonGenerator .writeFieldName("compatible") .writeValue(devicePoolCompatibilityResult.getCompatible()); } java.util.List<IncompatibilityMessage> incompatibilityMessagesList = devicePoolCompatibilityResult.getIncompatibilityMessages(); if (incompatibilityMessagesList != null) { jsonGenerator.writeFieldName("incompatibilityMessages"); jsonGenerator.writeStartArray(); for (IncompatibilityMessage incompatibilityMessagesListValue : incompatibilityMessagesList) { if (incompatibilityMessagesListValue != null) { IncompatibilityMessageJsonMarshaller.getInstance() .marshall(incompatibilityMessagesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }