/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(Service service, JSONWriter jsonWriter) { if (service == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (service.getCode() != null) { jsonWriter.key("code").value(service.getCode()); } if (service.getName() != null) { jsonWriter.key("name").value(service.getName()); } com.amazonaws.internal.SdkInternalList<Category> categoriesList = (com.amazonaws.internal.SdkInternalList<Category>) service.getCategories(); if (!categoriesList.isEmpty() || !categoriesList.isAutoConstruct()) { jsonWriter.key("categories"); jsonWriter.array(); for (Category categoriesListValue : categoriesList) { if (categoriesListValue != null) { CategoryJsonMarshaller.getInstance().marshall(categoriesListValue, jsonWriter); } } jsonWriter.endArray(); } jsonWriter.endObject(); } 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(ParameterObject parameterObject, StructuredJsonGenerator jsonGenerator) { if (parameterObject == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (parameterObject.getId() != null) { jsonGenerator.writeFieldName("id").writeValue(parameterObject.getId()); } com.amazonaws.internal.SdkInternalList<ParameterAttribute> attributesList = (com.amazonaws.internal.SdkInternalList<ParameterAttribute>) parameterObject.getAttributes(); if (!attributesList.isEmpty() || !attributesList.isAutoConstruct()) { jsonGenerator.writeFieldName("attributes"); jsonGenerator.writeStartArray(); for (ParameterAttribute attributesListValue : attributesList) { if (attributesListValue != null) { ParameterAttributeJsonMarshaller.getInstance() .marshall(attributesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<DescribeEcsClustersRequest> marshall( DescribeEcsClustersRequest describeEcsClustersRequest) { if (describeEcsClustersRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeEcsClustersRequest> request = new DefaultRequest<DescribeEcsClustersRequest>(describeEcsClustersRequest, "AWSOpsWorks"); request.addHeader("X-Amz-Target", "OpsWorks_20130218.DescribeEcsClusters"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = SdkJsonProtocolFactory.createWriter(false, "1.1"); jsonGenerator.writeStartObject(); com.amazonaws.internal.SdkInternalList<String> ecsClusterArnsList = (com.amazonaws.internal.SdkInternalList<String>) describeEcsClustersRequest.getEcsClusterArns(); if (!ecsClusterArnsList.isEmpty() || !ecsClusterArnsList.isAutoConstruct()) { jsonGenerator.writeFieldName("EcsClusterArns"); jsonGenerator.writeStartArray(); for (String ecsClusterArnsListValue : ecsClusterArnsList) { if (ecsClusterArnsListValue != null) { jsonGenerator.writeValue(ecsClusterArnsListValue); } } jsonGenerator.writeEndArray(); } if (describeEcsClustersRequest.getStackId() != null) { jsonGenerator.writeFieldName("StackId").writeValue(describeEcsClustersRequest.getStackId()); } if (describeEcsClustersRequest.getNextToken() != null) { jsonGenerator .writeFieldName("NextToken") .writeValue(describeEcsClustersRequest.getNextToken()); } if (describeEcsClustersRequest.getMaxResults() != null) { jsonGenerator .writeFieldName("MaxResults") .writeValue(describeEcsClustersRequest.getMaxResults()); } 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<UpdateDomainNameserversRequest> marshall( UpdateDomainNameserversRequest updateDomainNameserversRequest) { if (updateDomainNameserversRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateDomainNameserversRequest> request = new DefaultRequest<UpdateDomainNameserversRequest>( updateDomainNameserversRequest, "AmazonRoute53Domains"); request.addHeader("X-Amz-Target", "Route53Domains_v20140515.UpdateDomainNameservers"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (updateDomainNameserversRequest.getDomainName() != null) { jsonWriter.key("DomainName").value(updateDomainNameserversRequest.getDomainName()); } if (updateDomainNameserversRequest.getFIAuthKey() != null) { jsonWriter.key("FIAuthKey").value(updateDomainNameserversRequest.getFIAuthKey()); } com.amazonaws.internal.SdkInternalList<Nameserver> nameserversList = (com.amazonaws.internal.SdkInternalList<Nameserver>) updateDomainNameserversRequest.getNameservers(); if (!nameserversList.isEmpty() || !nameserversList.isAutoConstruct()) { jsonWriter.key("Nameservers"); jsonWriter.array(); for (Nameserver nameserversListValue : nameserversList) { if (nameserversListValue != null) { NameserverJsonMarshaller.getInstance().marshall(nameserversListValue, jsonWriter); } } jsonWriter.endArray(); } 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; }
/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(TrustedAdvisorCheckResult trustedAdvisorCheckResult, JSONWriter jsonWriter) { if (trustedAdvisorCheckResult == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (trustedAdvisorCheckResult.getCheckId() != null) { jsonWriter.key("checkId").value(trustedAdvisorCheckResult.getCheckId()); } if (trustedAdvisorCheckResult.getTimestamp() != null) { jsonWriter.key("timestamp").value(trustedAdvisorCheckResult.getTimestamp()); } if (trustedAdvisorCheckResult.getStatus() != null) { jsonWriter.key("status").value(trustedAdvisorCheckResult.getStatus()); } if (trustedAdvisorCheckResult.getResourcesSummary() != null) { jsonWriter.key("resourcesSummary"); TrustedAdvisorResourcesSummaryJsonMarshaller.getInstance() .marshall(trustedAdvisorCheckResult.getResourcesSummary(), jsonWriter); } if (trustedAdvisorCheckResult.getCategorySpecificSummary() != null) { jsonWriter.key("categorySpecificSummary"); TrustedAdvisorCategorySpecificSummaryJsonMarshaller.getInstance() .marshall(trustedAdvisorCheckResult.getCategorySpecificSummary(), jsonWriter); } com.amazonaws.internal.SdkInternalList<TrustedAdvisorResourceDetail> flaggedResourcesList = (com.amazonaws.internal.SdkInternalList<TrustedAdvisorResourceDetail>) trustedAdvisorCheckResult.getFlaggedResources(); if (!flaggedResourcesList.isEmpty() || !flaggedResourcesList.isAutoConstruct()) { jsonWriter.key("flaggedResources"); jsonWriter.array(); for (TrustedAdvisorResourceDetail flaggedResourcesListValue : flaggedResourcesList) { if (flaggedResourcesListValue != null) { TrustedAdvisorResourceDetailJsonMarshaller.getInstance() .marshall(flaggedResourcesListValue, jsonWriter); } } jsonWriter.endArray(); } jsonWriter.endObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** 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); } }
/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(ContainerOverride containerOverride, JSONWriter jsonWriter) { if (containerOverride == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (containerOverride.getName() != null) { jsonWriter.key("name").value(containerOverride.getName()); } com.amazonaws.internal.SdkInternalList<String> commandList = (com.amazonaws.internal.SdkInternalList<String>) containerOverride.getCommand(); if (!commandList.isEmpty() || !commandList.isAutoConstruct()) { jsonWriter.key("command"); jsonWriter.array(); for (String commandListValue : commandList) { if (commandListValue != null) { jsonWriter.value(commandListValue); } } jsonWriter.endArray(); } com.amazonaws.internal.SdkInternalList<KeyValuePair> environmentList = (com.amazonaws.internal.SdkInternalList<KeyValuePair>) containerOverride.getEnvironment(); if (!environmentList.isEmpty() || !environmentList.isAutoConstruct()) { jsonWriter.key("environment"); jsonWriter.array(); for (KeyValuePair environmentListValue : environmentList) { if (environmentListValue != null) { KeyValuePairJsonMarshaller.getInstance().marshall(environmentListValue, jsonWriter); } } jsonWriter.endArray(); } jsonWriter.endObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(TaskDefinition taskDefinition, JSONWriter jsonWriter) { if (taskDefinition == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (taskDefinition.getTaskDefinitionArn() != null) { jsonWriter.key("taskDefinitionArn").value(taskDefinition.getTaskDefinitionArn()); } com.amazonaws.internal.SdkInternalList<ContainerDefinition> containerDefinitionsList = (com.amazonaws.internal.SdkInternalList<ContainerDefinition>) taskDefinition.getContainerDefinitions(); if (!containerDefinitionsList.isEmpty() || !containerDefinitionsList.isAutoConstruct()) { jsonWriter.key("containerDefinitions"); jsonWriter.array(); for (ContainerDefinition containerDefinitionsListValue : containerDefinitionsList) { if (containerDefinitionsListValue != null) { ContainerDefinitionJsonMarshaller.getInstance() .marshall(containerDefinitionsListValue, jsonWriter); } } jsonWriter.endArray(); } if (taskDefinition.getFamily() != null) { jsonWriter.key("family").value(taskDefinition.getFamily()); } if (taskDefinition.getRevision() != null) { jsonWriter.key("revision").value(taskDefinition.getRevision()); } com.amazonaws.internal.SdkInternalList<Volume> volumesList = (com.amazonaws.internal.SdkInternalList<Volume>) taskDefinition.getVolumes(); if (!volumesList.isEmpty() || !volumesList.isAutoConstruct()) { jsonWriter.key("volumes"); jsonWriter.array(); for (Volume volumesListValue : volumesList) { if (volumesListValue != null) { VolumeJsonMarshaller.getInstance().marshall(volumesListValue, jsonWriter); } } jsonWriter.endArray(); } if (taskDefinition.getStatus() != null) { jsonWriter.key("status").value(taskDefinition.getStatus()); } com.amazonaws.internal.SdkInternalList<Attribute> requiresAttributesList = (com.amazonaws.internal.SdkInternalList<Attribute>) taskDefinition.getRequiresAttributes(); if (!requiresAttributesList.isEmpty() || !requiresAttributesList.isAutoConstruct()) { jsonWriter.key("requiresAttributes"); jsonWriter.array(); for (Attribute requiresAttributesListValue : requiresAttributesList) { if (requiresAttributesListValue != null) { AttributeJsonMarshaller.getInstance().marshall(requiresAttributesListValue, jsonWriter); } } jsonWriter.endArray(); } jsonWriter.endObject(); } 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(JobOutput jobOutput, StructuredJsonGenerator jsonGenerator) { if (jobOutput == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (jobOutput.getId() != null) { jsonGenerator.writeFieldName("Id").writeValue(jobOutput.getId()); } if (jobOutput.getKey() != null) { jsonGenerator.writeFieldName("Key").writeValue(jobOutput.getKey()); } if (jobOutput.getThumbnailPattern() != null) { jsonGenerator .writeFieldName("ThumbnailPattern") .writeValue(jobOutput.getThumbnailPattern()); } if (jobOutput.getThumbnailEncryption() != null) { jsonGenerator.writeFieldName("ThumbnailEncryption"); EncryptionJsonMarshaller.getInstance() .marshall(jobOutput.getThumbnailEncryption(), jsonGenerator); } if (jobOutput.getRotate() != null) { jsonGenerator.writeFieldName("Rotate").writeValue(jobOutput.getRotate()); } if (jobOutput.getPresetId() != null) { jsonGenerator.writeFieldName("PresetId").writeValue(jobOutput.getPresetId()); } if (jobOutput.getSegmentDuration() != null) { jsonGenerator.writeFieldName("SegmentDuration").writeValue(jobOutput.getSegmentDuration()); } if (jobOutput.getStatus() != null) { jsonGenerator.writeFieldName("Status").writeValue(jobOutput.getStatus()); } if (jobOutput.getStatusDetail() != null) { jsonGenerator.writeFieldName("StatusDetail").writeValue(jobOutput.getStatusDetail()); } if (jobOutput.getDuration() != null) { jsonGenerator.writeFieldName("Duration").writeValue(jobOutput.getDuration()); } if (jobOutput.getWidth() != null) { jsonGenerator.writeFieldName("Width").writeValue(jobOutput.getWidth()); } if (jobOutput.getHeight() != null) { jsonGenerator.writeFieldName("Height").writeValue(jobOutput.getHeight()); } if (jobOutput.getFrameRate() != null) { jsonGenerator.writeFieldName("FrameRate").writeValue(jobOutput.getFrameRate()); } if (jobOutput.getFileSize() != null) { jsonGenerator.writeFieldName("FileSize").writeValue(jobOutput.getFileSize()); } if (jobOutput.getDurationMillis() != null) { jsonGenerator.writeFieldName("DurationMillis").writeValue(jobOutput.getDurationMillis()); } com.amazonaws.internal.SdkInternalList<JobWatermark> watermarksList = (com.amazonaws.internal.SdkInternalList<JobWatermark>) jobOutput.getWatermarks(); if (!watermarksList.isEmpty() || !watermarksList.isAutoConstruct()) { jsonGenerator.writeFieldName("Watermarks"); jsonGenerator.writeStartArray(); for (JobWatermark watermarksListValue : watermarksList) { if (watermarksListValue != null) { JobWatermarkJsonMarshaller.getInstance().marshall(watermarksListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (jobOutput.getAlbumArt() != null) { jsonGenerator.writeFieldName("AlbumArt"); JobAlbumArtJsonMarshaller.getInstance().marshall(jobOutput.getAlbumArt(), jsonGenerator); } com.amazonaws.internal.SdkInternalList<Clip> compositionList = (com.amazonaws.internal.SdkInternalList<Clip>) jobOutput.getComposition(); if (!compositionList.isEmpty() || !compositionList.isAutoConstruct()) { jsonGenerator.writeFieldName("Composition"); jsonGenerator.writeStartArray(); for (Clip compositionListValue : compositionList) { if (compositionListValue != null) { ClipJsonMarshaller.getInstance().marshall(compositionListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (jobOutput.getCaptions() != null) { jsonGenerator.writeFieldName("Captions"); CaptionsJsonMarshaller.getInstance().marshall(jobOutput.getCaptions(), jsonGenerator); } if (jobOutput.getEncryption() != null) { jsonGenerator.writeFieldName("Encryption"); EncryptionJsonMarshaller.getInstance().marshall(jobOutput.getEncryption(), jsonGenerator); } if (jobOutput.getAppliedColorSpaceConversion() != null) { jsonGenerator .writeFieldName("AppliedColorSpaceConversion") .writeValue(jobOutput.getAppliedColorSpaceConversion()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<DescribeInstanceInformationRequest> marshall( DescribeInstanceInformationRequest describeInstanceInformationRequest) { if (describeInstanceInformationRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeInstanceInformationRequest> request = new DefaultRequest<DescribeInstanceInformationRequest>( describeInstanceInformationRequest, "AWSSimpleSystemsManagement"); request.addHeader("X-Amz-Target", "AmazonSSM.DescribeInstanceInformation"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); com.amazonaws.internal.SdkInternalList<InstanceInformationFilter> instanceInformationFilterListList = (com.amazonaws.internal.SdkInternalList<InstanceInformationFilter>) describeInstanceInformationRequest.getInstanceInformationFilterList(); if (!instanceInformationFilterListList.isEmpty() || !instanceInformationFilterListList.isAutoConstruct()) { jsonWriter.key("InstanceInformationFilterList"); jsonWriter.array(); for (InstanceInformationFilter instanceInformationFilterListListValue : instanceInformationFilterListList) { if (instanceInformationFilterListListValue != null) { InstanceInformationFilterJsonMarshaller.getInstance() .marshall(instanceInformationFilterListListValue, jsonWriter); } } jsonWriter.endArray(); } if (describeInstanceInformationRequest.getMaxResults() != null) { jsonWriter.key("MaxResults").value(describeInstanceInformationRequest.getMaxResults()); } if (describeInstanceInformationRequest.getNextToken() != null) { jsonWriter.key("NextToken").value(describeInstanceInformationRequest.getNextToken()); } 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; }
/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(RDSDataSpec rDSDataSpec, JSONWriter jsonWriter) { if (rDSDataSpec == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (rDSDataSpec.getDatabaseInformation() != null) { jsonWriter.key("DatabaseInformation"); RDSDatabaseJsonMarshaller.getInstance() .marshall(rDSDataSpec.getDatabaseInformation(), jsonWriter); } if (rDSDataSpec.getSelectSqlQuery() != null) { jsonWriter.key("SelectSqlQuery").value(rDSDataSpec.getSelectSqlQuery()); } if (rDSDataSpec.getDatabaseCredentials() != null) { jsonWriter.key("DatabaseCredentials"); RDSDatabaseCredentialsJsonMarshaller.getInstance() .marshall(rDSDataSpec.getDatabaseCredentials(), jsonWriter); } if (rDSDataSpec.getS3StagingLocation() != null) { jsonWriter.key("S3StagingLocation").value(rDSDataSpec.getS3StagingLocation()); } if (rDSDataSpec.getDataRearrangement() != null) { jsonWriter.key("DataRearrangement").value(rDSDataSpec.getDataRearrangement()); } if (rDSDataSpec.getDataSchema() != null) { jsonWriter.key("DataSchema").value(rDSDataSpec.getDataSchema()); } if (rDSDataSpec.getDataSchemaUri() != null) { jsonWriter.key("DataSchemaUri").value(rDSDataSpec.getDataSchemaUri()); } if (rDSDataSpec.getResourceRole() != null) { jsonWriter.key("ResourceRole").value(rDSDataSpec.getResourceRole()); } if (rDSDataSpec.getServiceRole() != null) { jsonWriter.key("ServiceRole").value(rDSDataSpec.getServiceRole()); } if (rDSDataSpec.getSubnetId() != null) { jsonWriter.key("SubnetId").value(rDSDataSpec.getSubnetId()); } com.amazonaws.internal.SdkInternalList<String> securityGroupIdsList = (com.amazonaws.internal.SdkInternalList<String>) rDSDataSpec.getSecurityGroupIds(); if (!securityGroupIdsList.isEmpty() || !securityGroupIdsList.isAutoConstruct()) { jsonWriter.key("SecurityGroupIds"); jsonWriter.array(); for (String securityGroupIdsListValue : securityGroupIdsList) { if (securityGroupIdsListValue != null) { jsonWriter.value(securityGroupIdsListValue); } } jsonWriter.endArray(); } jsonWriter.endObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }