public Request<CreateWorkspacesRequest> marshall( CreateWorkspacesRequest createWorkspacesRequest) { if (createWorkspacesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateWorkspacesRequest> request = new DefaultRequest<CreateWorkspacesRequest>(createWorkspacesRequest, "AmazonWorkspaces"); String target = "WorkspacesService.CreateWorkspaces"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); com.amazonaws.internal.ListWithAutoConstructFlag<WorkspaceRequest> workspacesList = (com.amazonaws.internal.ListWithAutoConstructFlag<WorkspaceRequest>) (createWorkspacesRequest.getWorkspaces()); if (workspacesList != null && !(workspacesList.isAutoConstruct() && workspacesList.isEmpty())) { jsonWriter.key("Workspaces"); jsonWriter.array(); for (WorkspaceRequest workspacesListValue : workspacesList) { if (workspacesListValue != null) { jsonWriter.object(); if (workspacesListValue.getDirectoryId() != null) { jsonWriter.key("DirectoryId").value(workspacesListValue.getDirectoryId()); } if (workspacesListValue.getUserName() != null) { jsonWriter.key("UserName").value(workspacesListValue.getUserName()); } if (workspacesListValue.getBundleId() != null) { jsonWriter.key("BundleId").value(workspacesListValue.getBundleId()); } jsonWriter.endObject(); } } 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; }
public Request<AddUploadBufferRequest> marshall(AddUploadBufferRequest addUploadBufferRequest) { if (addUploadBufferRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<AddUploadBufferRequest> request = new DefaultRequest<AddUploadBufferRequest>(addUploadBufferRequest, "AWSStorageGateway"); String target = "StorageGateway_20130630.AddUploadBuffer"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.1"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = ""; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { request.addParameter(nameValuePair[0], nameValuePair[1]); } else { request.addParameter(s, null); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (addUploadBufferRequest.getGatewayARN() != null) { jsonWriter.key("GatewayARN").value(addUploadBufferRequest.getGatewayARN()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> diskIdsList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (addUploadBufferRequest.getDiskIds()); if (diskIdsList != null && !(diskIdsList.isAutoConstruct() && diskIdsList.isEmpty())) { jsonWriter.key("DiskIds"); jsonWriter.array(); for (String diskIdsListValue : diskIdsList) { if (diskIdsListValue != null) { jsonWriter.value(diskIdsListValue); } } 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)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<UpdateRecordsRequest> marshall(UpdateRecordsRequest updateRecordsRequest) { if (updateRecordsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateRecordsRequest> request = new DefaultRequest<UpdateRecordsRequest>(updateRecordsRequest, "AmazonCognitoSync"); String target = "AWSCognitoSyncService.UpdateRecords"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); if (updateRecordsRequest.getClientContext() != null) request.addHeader( "x-amz-Client-Context", StringUtils.fromString(updateRecordsRequest.getClientContext())); String uriResourcePath = RESOURCE_PATH_TEMPLATE; if (DYNAMIC_QUERY_PARAMS.containsKey("IdentityPoolId")) { String name = DYNAMIC_QUERY_PARAMS.get("IdentityPoolId"); String value = (updateRecordsRequest.getIdentityPoolId() == null) ? null : StringUtils.fromString(updateRecordsRequest.getIdentityPoolId()); if (!(value == null || value.isEmpty())) { request.addParameter(name, value); } } else { uriResourcePath = uriResourcePath.replace( "{IdentityPoolId}", (updateRecordsRequest.getIdentityPoolId() == null) ? "" : StringUtils.fromString(updateRecordsRequest.getIdentityPoolId())); } if (DYNAMIC_QUERY_PARAMS.containsKey("IdentityId")) { String name = DYNAMIC_QUERY_PARAMS.get("IdentityId"); String value = (updateRecordsRequest.getIdentityId() == null) ? null : StringUtils.fromString(updateRecordsRequest.getIdentityId()); if (!(value == null || value.isEmpty())) { request.addParameter(name, value); } } else { uriResourcePath = uriResourcePath.replace( "{IdentityId}", (updateRecordsRequest.getIdentityId() == null) ? "" : StringUtils.fromString(updateRecordsRequest.getIdentityId())); } if (DYNAMIC_QUERY_PARAMS.containsKey("DatasetName")) { String name = DYNAMIC_QUERY_PARAMS.get("DatasetName"); String value = (updateRecordsRequest.getDatasetName() == null) ? null : StringUtils.fromString(updateRecordsRequest.getDatasetName()); if (!(value == null || value.isEmpty())) { request.addParameter(name, value); } } else { uriResourcePath = uriResourcePath.replace( "{DatasetName}", (updateRecordsRequest.getDatasetName() == null) ? "" : StringUtils.fromString(updateRecordsRequest.getDatasetName())); } request.setResourcePath(uriResourcePath.replaceAll("//", "/")); for (Map.Entry<String, String> entry : STATIC_QUERY_PARAMS.entrySet()) { request.addParameter(entry.getKey(), entry.getValue()); } try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); com.amazonaws.internal.ListWithAutoConstructFlag<RecordPatch> recordPatchesList = (com.amazonaws.internal.ListWithAutoConstructFlag<RecordPatch>) (updateRecordsRequest.getRecordPatches()); if (recordPatchesList != null && !(recordPatchesList.isAutoConstruct() && recordPatchesList.isEmpty())) { jsonWriter.key("RecordPatches"); jsonWriter.array(); for (RecordPatch recordPatchesListValue : recordPatchesList) { if (recordPatchesListValue != null) { jsonWriter.object(); if (recordPatchesListValue.getOp() != null) { jsonWriter.key("Op").value(recordPatchesListValue.getOp()); } if (recordPatchesListValue.getKey() != null) { jsonWriter.key("Key").value(recordPatchesListValue.getKey()); } if (recordPatchesListValue.getValue() != null) { jsonWriter.key("Value").value(recordPatchesListValue.getValue()); } if (recordPatchesListValue.getSyncCount() != null) { jsonWriter.key("SyncCount").value(recordPatchesListValue.getSyncCount()); } if (recordPatchesListValue.getDeviceLastModifiedDate() != null) { jsonWriter .key("DeviceLastModifiedDate") .value(recordPatchesListValue.getDeviceLastModifiedDate()); } jsonWriter.endObject(); } } jsonWriter.endArray(); } if (updateRecordsRequest.getSyncSessionToken() != null) { jsonWriter.key("SyncSessionToken").value(updateRecordsRequest.getSyncSessionToken()); } 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.0"); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<StartWorkflowExecutionRequest> marshall( StartWorkflowExecutionRequest startWorkflowExecutionRequest) { if (startWorkflowExecutionRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<StartWorkflowExecutionRequest> request = new DefaultRequest<StartWorkflowExecutionRequest>( startWorkflowExecutionRequest, "AmazonSimpleWorkflow"); String target = "SimpleWorkflowService.StartWorkflowExecution"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (startWorkflowExecutionRequest.getDomain() != null) { jsonWriter.key("domain").value(startWorkflowExecutionRequest.getDomain()); } if (startWorkflowExecutionRequest.getWorkflowId() != null) { jsonWriter.key("workflowId").value(startWorkflowExecutionRequest.getWorkflowId()); } WorkflowType workflowType = startWorkflowExecutionRequest.getWorkflowType(); if (workflowType != null) { jsonWriter.key("workflowType"); jsonWriter.object(); if (workflowType.getName() != null) { jsonWriter.key("name").value(workflowType.getName()); } if (workflowType.getVersion() != null) { jsonWriter.key("version").value(workflowType.getVersion()); } jsonWriter.endObject(); } TaskList taskList = startWorkflowExecutionRequest.getTaskList(); if (taskList != null) { jsonWriter.key("taskList"); jsonWriter.object(); if (taskList.getName() != null) { jsonWriter.key("name").value(taskList.getName()); } jsonWriter.endObject(); } if (startWorkflowExecutionRequest.getInput() != null) { jsonWriter.key("input").value(startWorkflowExecutionRequest.getInput()); } if (startWorkflowExecutionRequest.getExecutionStartToCloseTimeout() != null) { jsonWriter .key("executionStartToCloseTimeout") .value(startWorkflowExecutionRequest.getExecutionStartToCloseTimeout()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> tagListList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (startWorkflowExecutionRequest.getTagList()); if (tagListList != null && !(tagListList.isAutoConstruct() && tagListList.isEmpty())) { jsonWriter.key("tagList"); jsonWriter.array(); for (String tagListListValue : tagListList) { if (tagListListValue != null) { jsonWriter.value(tagListListValue); } } jsonWriter.endArray(); } if (startWorkflowExecutionRequest.getTaskStartToCloseTimeout() != null) { jsonWriter .key("taskStartToCloseTimeout") .value(startWorkflowExecutionRequest.getTaskStartToCloseTimeout()); } if (startWorkflowExecutionRequest.getChildPolicy() != null) { jsonWriter.key("childPolicy").value(startWorkflowExecutionRequest.getChildPolicy()); } 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.0"); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<SetStatusRequest> marshall(SetStatusRequest setStatusRequest) { if (setStatusRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<SetStatusRequest> request = new DefaultRequest<SetStatusRequest>(setStatusRequest, "DataPipeline"); String target = "DataPipeline.SetStatus"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.1"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = ""; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { request.addParameter(nameValuePair[0], nameValuePair[1]); } else { request.addParameter(s, null); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (setStatusRequest.getPipelineId() != null) { jsonWriter.key("pipelineId").value(setStatusRequest.getPipelineId()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> objectIdsList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (setStatusRequest.getObjectIds()); if (objectIdsList != null && !(objectIdsList.isAutoConstruct() && objectIdsList.isEmpty())) { jsonWriter.key("objectIds"); jsonWriter.array(); for (String objectIdsListValue : objectIdsList) { if (objectIdsListValue != null) { jsonWriter.value(objectIdsListValue); } } jsonWriter.endArray(); } if (setStatusRequest.getStatus() != null) { jsonWriter.key("status").value(setStatusRequest.getStatus()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<CreateJobRequest> marshall(CreateJobRequest createJobRequest) { if (createJobRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateJobRequest> request = new DefaultRequest<CreateJobRequest>(createJobRequest, "AmazonElasticTranscoder"); String target = "EtsCustomerService.CreateJob"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "2012-09-25/jobs"; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { if (!(nameValuePair[1].isEmpty())) request.addParameter(nameValuePair[0], nameValuePair[1]); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (createJobRequest.getPipelineId() != null) { jsonWriter.key("PipelineId").value(createJobRequest.getPipelineId()); } JobInput input = createJobRequest.getInput(); if (input != null) { jsonWriter.key("Input"); jsonWriter.object(); if (input.getKey() != null) { jsonWriter.key("Key").value(input.getKey()); } if (input.getFrameRate() != null) { jsonWriter.key("FrameRate").value(input.getFrameRate()); } if (input.getResolution() != null) { jsonWriter.key("Resolution").value(input.getResolution()); } if (input.getAspectRatio() != null) { jsonWriter.key("AspectRatio").value(input.getAspectRatio()); } if (input.getInterlaced() != null) { jsonWriter.key("Interlaced").value(input.getInterlaced()); } if (input.getContainer() != null) { jsonWriter.key("Container").value(input.getContainer()); } jsonWriter.endObject(); } CreateJobOutput output = createJobRequest.getOutput(); if (output != null) { jsonWriter.key("Output"); jsonWriter.object(); if (output.getKey() != null) { jsonWriter.key("Key").value(output.getKey()); } if (output.getThumbnailPattern() != null) { jsonWriter.key("ThumbnailPattern").value(output.getThumbnailPattern()); } if (output.getRotate() != null) { jsonWriter.key("Rotate").value(output.getRotate()); } if (output.getPresetId() != null) { jsonWriter.key("PresetId").value(output.getPresetId()); } if (output.getSegmentDuration() != null) { jsonWriter.key("SegmentDuration").value(output.getSegmentDuration()); } com.amazonaws.internal.ListWithAutoConstructFlag<JobWatermark> watermarksList = (com.amazonaws.internal.ListWithAutoConstructFlag<JobWatermark>) (output.getWatermarks()); if (watermarksList != null && !(watermarksList.isAutoConstruct() && watermarksList.isEmpty())) { jsonWriter.key("Watermarks"); jsonWriter.array(); for (JobWatermark watermarksListValue : watermarksList) { if (watermarksListValue != null) { jsonWriter.object(); if (watermarksListValue.getPresetWatermarkId() != null) { jsonWriter .key("PresetWatermarkId") .value(watermarksListValue.getPresetWatermarkId()); } if (watermarksListValue.getInputKey() != null) { jsonWriter.key("InputKey").value(watermarksListValue.getInputKey()); } jsonWriter.endObject(); } } jsonWriter.endArray(); } JobAlbumArt albumArt = output.getAlbumArt(); if (albumArt != null) { jsonWriter.key("AlbumArt"); jsonWriter.object(); if (albumArt.getMergePolicy() != null) { jsonWriter.key("MergePolicy").value(albumArt.getMergePolicy()); } com.amazonaws.internal.ListWithAutoConstructFlag<Artwork> artworkList = (com.amazonaws.internal.ListWithAutoConstructFlag<Artwork>) (albumArt.getArtwork()); if (artworkList != null && !(artworkList.isAutoConstruct() && artworkList.isEmpty())) { jsonWriter.key("Artwork"); jsonWriter.array(); for (Artwork artworkListValue : artworkList) { if (artworkListValue != null) { jsonWriter.object(); if (artworkListValue.getInputKey() != null) { jsonWriter.key("InputKey").value(artworkListValue.getInputKey()); } if (artworkListValue.getMaxWidth() != null) { jsonWriter.key("MaxWidth").value(artworkListValue.getMaxWidth()); } if (artworkListValue.getMaxHeight() != null) { jsonWriter.key("MaxHeight").value(artworkListValue.getMaxHeight()); } if (artworkListValue.getSizingPolicy() != null) { jsonWriter.key("SizingPolicy").value(artworkListValue.getSizingPolicy()); } if (artworkListValue.getPaddingPolicy() != null) { jsonWriter.key("PaddingPolicy").value(artworkListValue.getPaddingPolicy()); } if (artworkListValue.getAlbumArtFormat() != null) { jsonWriter.key("AlbumArtFormat").value(artworkListValue.getAlbumArtFormat()); } jsonWriter.endObject(); } } jsonWriter.endArray(); } jsonWriter.endObject(); } com.amazonaws.internal.ListWithAutoConstructFlag<Clip> compositionList = (com.amazonaws.internal.ListWithAutoConstructFlag<Clip>) (output.getComposition()); if (compositionList != null && !(compositionList.isAutoConstruct() && compositionList.isEmpty())) { jsonWriter.key("Composition"); jsonWriter.array(); for (Clip compositionListValue : compositionList) { if (compositionListValue != null) { jsonWriter.object(); TimeSpan timeSpan = compositionListValue.getTimeSpan(); if (timeSpan != null) { jsonWriter.key("TimeSpan"); jsonWriter.object(); if (timeSpan.getStartTime() != null) { jsonWriter.key("StartTime").value(timeSpan.getStartTime()); } if (timeSpan.getDuration() != null) { jsonWriter.key("Duration").value(timeSpan.getDuration()); } jsonWriter.endObject(); } jsonWriter.endObject(); } } jsonWriter.endArray(); } jsonWriter.endObject(); } com.amazonaws.internal.ListWithAutoConstructFlag<CreateJobOutput> outputsList = (com.amazonaws.internal.ListWithAutoConstructFlag<CreateJobOutput>) (createJobRequest.getOutputs()); if (outputsList != null && !(outputsList.isAutoConstruct() && outputsList.isEmpty())) { jsonWriter.key("Outputs"); jsonWriter.array(); for (CreateJobOutput outputsListValue : outputsList) { if (outputsListValue != null) { jsonWriter.object(); if (outputsListValue.getKey() != null) { jsonWriter.key("Key").value(outputsListValue.getKey()); } if (outputsListValue.getThumbnailPattern() != null) { jsonWriter.key("ThumbnailPattern").value(outputsListValue.getThumbnailPattern()); } if (outputsListValue.getRotate() != null) { jsonWriter.key("Rotate").value(outputsListValue.getRotate()); } if (outputsListValue.getPresetId() != null) { jsonWriter.key("PresetId").value(outputsListValue.getPresetId()); } if (outputsListValue.getSegmentDuration() != null) { jsonWriter.key("SegmentDuration").value(outputsListValue.getSegmentDuration()); } com.amazonaws.internal.ListWithAutoConstructFlag<JobWatermark> watermarksList = (com.amazonaws.internal.ListWithAutoConstructFlag<JobWatermark>) (outputsListValue.getWatermarks()); if (watermarksList != null && !(watermarksList.isAutoConstruct() && watermarksList.isEmpty())) { jsonWriter.key("Watermarks"); jsonWriter.array(); for (JobWatermark watermarksListValue : watermarksList) { if (watermarksListValue != null) { jsonWriter.object(); if (watermarksListValue.getPresetWatermarkId() != null) { jsonWriter .key("PresetWatermarkId") .value(watermarksListValue.getPresetWatermarkId()); } if (watermarksListValue.getInputKey() != null) { jsonWriter.key("InputKey").value(watermarksListValue.getInputKey()); } jsonWriter.endObject(); } } jsonWriter.endArray(); } JobAlbumArt albumArt = outputsListValue.getAlbumArt(); if (albumArt != null) { jsonWriter.key("AlbumArt"); jsonWriter.object(); if (albumArt.getMergePolicy() != null) { jsonWriter.key("MergePolicy").value(albumArt.getMergePolicy()); } com.amazonaws.internal.ListWithAutoConstructFlag<Artwork> artworkList = (com.amazonaws.internal.ListWithAutoConstructFlag<Artwork>) (albumArt.getArtwork()); if (artworkList != null && !(artworkList.isAutoConstruct() && artworkList.isEmpty())) { jsonWriter.key("Artwork"); jsonWriter.array(); for (Artwork artworkListValue : artworkList) { if (artworkListValue != null) { jsonWriter.object(); if (artworkListValue.getInputKey() != null) { jsonWriter.key("InputKey").value(artworkListValue.getInputKey()); } if (artworkListValue.getMaxWidth() != null) { jsonWriter.key("MaxWidth").value(artworkListValue.getMaxWidth()); } if (artworkListValue.getMaxHeight() != null) { jsonWriter.key("MaxHeight").value(artworkListValue.getMaxHeight()); } if (artworkListValue.getSizingPolicy() != null) { jsonWriter.key("SizingPolicy").value(artworkListValue.getSizingPolicy()); } if (artworkListValue.getPaddingPolicy() != null) { jsonWriter.key("PaddingPolicy").value(artworkListValue.getPaddingPolicy()); } if (artworkListValue.getAlbumArtFormat() != null) { jsonWriter.key("AlbumArtFormat").value(artworkListValue.getAlbumArtFormat()); } jsonWriter.endObject(); } } jsonWriter.endArray(); } jsonWriter.endObject(); } com.amazonaws.internal.ListWithAutoConstructFlag<Clip> compositionList = (com.amazonaws.internal.ListWithAutoConstructFlag<Clip>) (outputsListValue.getComposition()); if (compositionList != null && !(compositionList.isAutoConstruct() && compositionList.isEmpty())) { jsonWriter.key("Composition"); jsonWriter.array(); for (Clip compositionListValue : compositionList) { if (compositionListValue != null) { jsonWriter.object(); TimeSpan timeSpan = compositionListValue.getTimeSpan(); if (timeSpan != null) { jsonWriter.key("TimeSpan"); jsonWriter.object(); if (timeSpan.getStartTime() != null) { jsonWriter.key("StartTime").value(timeSpan.getStartTime()); } if (timeSpan.getDuration() != null) { jsonWriter.key("Duration").value(timeSpan.getDuration()); } jsonWriter.endObject(); } jsonWriter.endObject(); } } jsonWriter.endArray(); } jsonWriter.endObject(); } } jsonWriter.endArray(); } if (createJobRequest.getOutputKeyPrefix() != null) { jsonWriter.key("OutputKeyPrefix").value(createJobRequest.getOutputKeyPrefix()); } com.amazonaws.internal.ListWithAutoConstructFlag<CreateJobPlaylist> playlistsList = (com.amazonaws.internal.ListWithAutoConstructFlag<CreateJobPlaylist>) (createJobRequest.getPlaylists()); if (playlistsList != null && !(playlistsList.isAutoConstruct() && playlistsList.isEmpty())) { jsonWriter.key("Playlists"); jsonWriter.array(); for (CreateJobPlaylist playlistsListValue : playlistsList) { if (playlistsListValue != null) { jsonWriter.object(); if (playlistsListValue.getName() != null) { jsonWriter.key("Name").value(playlistsListValue.getName()); } if (playlistsListValue.getFormat() != null) { jsonWriter.key("Format").value(playlistsListValue.getFormat()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> outputKeysList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (playlistsListValue.getOutputKeys()); if (outputKeysList != null && !(outputKeysList.isAutoConstruct() && outputKeysList.isEmpty())) { jsonWriter.key("OutputKeys"); jsonWriter.array(); for (String outputKeysListValue : outputKeysList) { if (outputKeysListValue != null) { jsonWriter.value(outputKeysListValue); } } jsonWriter.endArray(); } jsonWriter.endObject(); } } 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.0"); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<CreateInstanceRequest> marshall(CreateInstanceRequest createInstanceRequest) { if (createInstanceRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateInstanceRequest> request = new DefaultRequest<CreateInstanceRequest>(createInstanceRequest, "AWSOpsWorks"); String target = "OpsWorks_20130218.CreateInstance"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (createInstanceRequest.getStackId() != null) { jsonWriter.key("StackId").value(createInstanceRequest.getStackId()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> layerIdsList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (createInstanceRequest.getLayerIds()); if (layerIdsList != null && !(layerIdsList.isAutoConstruct() && layerIdsList.isEmpty())) { jsonWriter.key("LayerIds"); jsonWriter.array(); for (String layerIdsListValue : layerIdsList) { if (layerIdsListValue != null) { jsonWriter.value(layerIdsListValue); } } jsonWriter.endArray(); } if (createInstanceRequest.getInstanceType() != null) { jsonWriter.key("InstanceType").value(createInstanceRequest.getInstanceType()); } if (createInstanceRequest.getAutoScalingType() != null) { jsonWriter.key("AutoScalingType").value(createInstanceRequest.getAutoScalingType()); } if (createInstanceRequest.getHostname() != null) { jsonWriter.key("Hostname").value(createInstanceRequest.getHostname()); } if (createInstanceRequest.getOs() != null) { jsonWriter.key("Os").value(createInstanceRequest.getOs()); } if (createInstanceRequest.getAmiId() != null) { jsonWriter.key("AmiId").value(createInstanceRequest.getAmiId()); } if (createInstanceRequest.getSshKeyName() != null) { jsonWriter.key("SshKeyName").value(createInstanceRequest.getSshKeyName()); } if (createInstanceRequest.getAvailabilityZone() != null) { jsonWriter.key("AvailabilityZone").value(createInstanceRequest.getAvailabilityZone()); } if (createInstanceRequest.getVirtualizationType() != null) { jsonWriter.key("VirtualizationType").value(createInstanceRequest.getVirtualizationType()); } if (createInstanceRequest.getSubnetId() != null) { jsonWriter.key("SubnetId").value(createInstanceRequest.getSubnetId()); } if (createInstanceRequest.getArchitecture() != null) { jsonWriter.key("Architecture").value(createInstanceRequest.getArchitecture()); } if (createInstanceRequest.getRootDeviceType() != null) { jsonWriter.key("RootDeviceType").value(createInstanceRequest.getRootDeviceType()); } com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping> blockDeviceMappingsList = (com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping>) (createInstanceRequest.getBlockDeviceMappings()); if (blockDeviceMappingsList != null && !(blockDeviceMappingsList.isAutoConstruct() && blockDeviceMappingsList.isEmpty())) { jsonWriter.key("BlockDeviceMappings"); jsonWriter.array(); for (BlockDeviceMapping blockDeviceMappingsListValue : blockDeviceMappingsList) { if (blockDeviceMappingsListValue != null) { jsonWriter.object(); if (blockDeviceMappingsListValue.getDeviceName() != null) { jsonWriter.key("DeviceName").value(blockDeviceMappingsListValue.getDeviceName()); } if (blockDeviceMappingsListValue.getNoDevice() != null) { jsonWriter.key("NoDevice").value(blockDeviceMappingsListValue.getNoDevice()); } if (blockDeviceMappingsListValue.getVirtualName() != null) { jsonWriter.key("VirtualName").value(blockDeviceMappingsListValue.getVirtualName()); } EbsBlockDevice ebs = blockDeviceMappingsListValue.getEbs(); if (ebs != null) { jsonWriter.key("Ebs"); jsonWriter.object(); if (ebs.getSnapshotId() != null) { jsonWriter.key("SnapshotId").value(ebs.getSnapshotId()); } if (ebs.getIops() != null) { jsonWriter.key("Iops").value(ebs.getIops()); } if (ebs.getVolumeSize() != null) { jsonWriter.key("VolumeSize").value(ebs.getVolumeSize()); } if (ebs.getVolumeType() != null) { jsonWriter.key("VolumeType").value(ebs.getVolumeType()); } if (ebs.isDeleteOnTermination() != null) { jsonWriter.key("DeleteOnTermination").value(ebs.isDeleteOnTermination()); } jsonWriter.endObject(); } jsonWriter.endObject(); } } jsonWriter.endArray(); } if (createInstanceRequest.isInstallUpdatesOnBoot() != null) { jsonWriter .key("InstallUpdatesOnBoot") .value(createInstanceRequest.isInstallUpdatesOnBoot()); } if (createInstanceRequest.isEbsOptimized() != null) { jsonWriter.key("EbsOptimized").value(createInstanceRequest.isEbsOptimized()); } if (createInstanceRequest.getAgentVersion() != null) { jsonWriter.key("AgentVersion").value(createInstanceRequest.getAgentVersion()); } 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; }
public Request<CreateDeploymentRequest> marshall( CreateDeploymentRequest createDeploymentRequest) { if (createDeploymentRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateDeploymentRequest> request = new DefaultRequest<CreateDeploymentRequest>(createDeploymentRequest, "AWSOpsWorks"); String target = "OpsWorks_20130218.CreateDeployment"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.1"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = ""; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { request.addParameter(nameValuePair[0], nameValuePair[1]); } else { request.addParameter(s, null); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (createDeploymentRequest.getStackId() != null) { jsonWriter.key("StackId").value(createDeploymentRequest.getStackId()); } if (createDeploymentRequest.getAppId() != null) { jsonWriter.key("AppId").value(createDeploymentRequest.getAppId()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> instanceIdsList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (createDeploymentRequest.getInstanceIds()); if (instanceIdsList != null && !(instanceIdsList.isAutoConstruct() && instanceIdsList.isEmpty())) { jsonWriter.key("InstanceIds"); jsonWriter.array(); for (String instanceIdsListValue : instanceIdsList) { if (instanceIdsListValue != null) { jsonWriter.value(instanceIdsListValue); } } jsonWriter.endArray(); } DeploymentCommand command = createDeploymentRequest.getCommand(); if (command != null) { jsonWriter.key("Command"); jsonWriter.object(); if (command.getName() != null) { jsonWriter.key("Name").value(command.getName()); } if (command.getArgs() != null) { jsonWriter.key("Args"); jsonWriter.object(); for (Map.Entry<String, java.util.List<String>> argsListValue : command.getArgs().entrySet()) { if (argsListValue.getValue() != null) { jsonWriter.key(argsListValue.getKey()); jsonWriter.array(); for (String valueListValue : argsListValue.getValue()) { if (valueListValue != null) { jsonWriter.value(valueListValue); } } jsonWriter.endArray(); } } jsonWriter.endObject(); } jsonWriter.endObject(); } if (createDeploymentRequest.getComment() != null) { jsonWriter.key("Comment").value(createDeploymentRequest.getComment()); } if (createDeploymentRequest.getCustomJson() != null) { jsonWriter.key("CustomJson").value(createDeploymentRequest.getCustomJson()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<CreatePresetRequest> marshall(CreatePresetRequest createPresetRequest) { if (createPresetRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreatePresetRequest> request = new DefaultRequest<CreatePresetRequest>(createPresetRequest, "AmazonElasticTranscoder"); String target = "EtsCustomerService.CreatePreset"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "2012-09-25/presets"; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { request.addParameter(nameValuePair[0], nameValuePair[1]); } else { request.addParameter(s, null); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (createPresetRequest.getName() != null) { jsonWriter.key("Name").value(createPresetRequest.getName()); } if (createPresetRequest.getDescription() != null) { jsonWriter.key("Description").value(createPresetRequest.getDescription()); } if (createPresetRequest.getContainer() != null) { jsonWriter.key("Container").value(createPresetRequest.getContainer()); } VideoParameters video = createPresetRequest.getVideo(); if (video != null) { jsonWriter.key("Video"); jsonWriter.object(); if (video.getCodec() != null) { jsonWriter.key("Codec").value(video.getCodec()); } if (video.getCodecOptions() != null) { jsonWriter.key("CodecOptions"); jsonWriter.object(); for (Map.Entry<String, String> codecOptionsListValue : video.getCodecOptions().entrySet()) { if (codecOptionsListValue.getValue() != null) { jsonWriter.key(codecOptionsListValue.getKey()); jsonWriter.value(codecOptionsListValue.getValue()); } } jsonWriter.endObject(); } if (video.getKeyframesMaxDist() != null) { jsonWriter.key("KeyframesMaxDist").value(video.getKeyframesMaxDist()); } if (video.getFixedGOP() != null) { jsonWriter.key("FixedGOP").value(video.getFixedGOP()); } if (video.getBitRate() != null) { jsonWriter.key("BitRate").value(video.getBitRate()); } if (video.getFrameRate() != null) { jsonWriter.key("FrameRate").value(video.getFrameRate()); } if (video.getMaxFrameRate() != null) { jsonWriter.key("MaxFrameRate").value(video.getMaxFrameRate()); } if (video.getResolution() != null) { jsonWriter.key("Resolution").value(video.getResolution()); } if (video.getAspectRatio() != null) { jsonWriter.key("AspectRatio").value(video.getAspectRatio()); } if (video.getMaxWidth() != null) { jsonWriter.key("MaxWidth").value(video.getMaxWidth()); } if (video.getMaxHeight() != null) { jsonWriter.key("MaxHeight").value(video.getMaxHeight()); } if (video.getDisplayAspectRatio() != null) { jsonWriter.key("DisplayAspectRatio").value(video.getDisplayAspectRatio()); } if (video.getSizingPolicy() != null) { jsonWriter.key("SizingPolicy").value(video.getSizingPolicy()); } if (video.getPaddingPolicy() != null) { jsonWriter.key("PaddingPolicy").value(video.getPaddingPolicy()); } com.amazonaws.internal.ListWithAutoConstructFlag<PresetWatermark> watermarksList = (com.amazonaws.internal.ListWithAutoConstructFlag<PresetWatermark>) (video.getWatermarks()); if (watermarksList != null && !(watermarksList.isAutoConstruct() && watermarksList.isEmpty())) { jsonWriter.key("Watermarks"); jsonWriter.array(); for (PresetWatermark watermarksListValue : watermarksList) { if (watermarksListValue != null) { jsonWriter.object(); if (watermarksListValue.getId() != null) { jsonWriter.key("Id").value(watermarksListValue.getId()); } if (watermarksListValue.getMaxWidth() != null) { jsonWriter.key("MaxWidth").value(watermarksListValue.getMaxWidth()); } if (watermarksListValue.getMaxHeight() != null) { jsonWriter.key("MaxHeight").value(watermarksListValue.getMaxHeight()); } if (watermarksListValue.getSizingPolicy() != null) { jsonWriter.key("SizingPolicy").value(watermarksListValue.getSizingPolicy()); } if (watermarksListValue.getHorizontalAlign() != null) { jsonWriter.key("HorizontalAlign").value(watermarksListValue.getHorizontalAlign()); } if (watermarksListValue.getHorizontalOffset() != null) { jsonWriter.key("HorizontalOffset").value(watermarksListValue.getHorizontalOffset()); } if (watermarksListValue.getVerticalAlign() != null) { jsonWriter.key("VerticalAlign").value(watermarksListValue.getVerticalAlign()); } if (watermarksListValue.getVerticalOffset() != null) { jsonWriter.key("VerticalOffset").value(watermarksListValue.getVerticalOffset()); } if (watermarksListValue.getOpacity() != null) { jsonWriter.key("Opacity").value(watermarksListValue.getOpacity()); } if (watermarksListValue.getTarget() != null) { jsonWriter.key("Target").value(watermarksListValue.getTarget()); } jsonWriter.endObject(); } } jsonWriter.endArray(); } jsonWriter.endObject(); } AudioParameters audio = createPresetRequest.getAudio(); if (audio != null) { jsonWriter.key("Audio"); jsonWriter.object(); if (audio.getCodec() != null) { jsonWriter.key("Codec").value(audio.getCodec()); } if (audio.getSampleRate() != null) { jsonWriter.key("SampleRate").value(audio.getSampleRate()); } if (audio.getBitRate() != null) { jsonWriter.key("BitRate").value(audio.getBitRate()); } if (audio.getChannels() != null) { jsonWriter.key("Channels").value(audio.getChannels()); } AudioCodecOptions codecOptions = audio.getCodecOptions(); if (codecOptions != null) { jsonWriter.key("CodecOptions"); jsonWriter.object(); if (codecOptions.getProfile() != null) { jsonWriter.key("Profile").value(codecOptions.getProfile()); } jsonWriter.endObject(); } jsonWriter.endObject(); } Thumbnails thumbnails = createPresetRequest.getThumbnails(); if (thumbnails != null) { jsonWriter.key("Thumbnails"); jsonWriter.object(); if (thumbnails.getFormat() != null) { jsonWriter.key("Format").value(thumbnails.getFormat()); } if (thumbnails.getInterval() != null) { jsonWriter.key("Interval").value(thumbnails.getInterval()); } if (thumbnails.getResolution() != null) { jsonWriter.key("Resolution").value(thumbnails.getResolution()); } if (thumbnails.getAspectRatio() != null) { jsonWriter.key("AspectRatio").value(thumbnails.getAspectRatio()); } if (thumbnails.getMaxWidth() != null) { jsonWriter.key("MaxWidth").value(thumbnails.getMaxWidth()); } if (thumbnails.getMaxHeight() != null) { jsonWriter.key("MaxHeight").value(thumbnails.getMaxHeight()); } if (thumbnails.getSizingPolicy() != null) { jsonWriter.key("SizingPolicy").value(thumbnails.getSizingPolicy()); } if (thumbnails.getPaddingPolicy() != null) { jsonWriter.key("PaddingPolicy").value(thumbnails.getPaddingPolicy()); } jsonWriter.endObject(); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<UpdateInstanceRequest> marshall(UpdateInstanceRequest updateInstanceRequest) { if (updateInstanceRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateInstanceRequest> request = new DefaultRequest<UpdateInstanceRequest>(updateInstanceRequest, "AWSOpsWorks"); String target = "OpsWorks_20130218.UpdateInstance"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (updateInstanceRequest.getInstanceId() != null) { jsonWriter.key("InstanceId").value(updateInstanceRequest.getInstanceId()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> layerIdsList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (updateInstanceRequest.getLayerIds()); if (layerIdsList != null && !(layerIdsList.isAutoConstruct() && layerIdsList.isEmpty())) { jsonWriter.key("LayerIds"); jsonWriter.array(); for (String layerIdsListValue : layerIdsList) { if (layerIdsListValue != null) { jsonWriter.value(layerIdsListValue); } } jsonWriter.endArray(); } if (updateInstanceRequest.getInstanceType() != null) { jsonWriter.key("InstanceType").value(updateInstanceRequest.getInstanceType()); } if (updateInstanceRequest.getAutoScalingType() != null) { jsonWriter.key("AutoScalingType").value(updateInstanceRequest.getAutoScalingType()); } if (updateInstanceRequest.getHostname() != null) { jsonWriter.key("Hostname").value(updateInstanceRequest.getHostname()); } if (updateInstanceRequest.getOs() != null) { jsonWriter.key("Os").value(updateInstanceRequest.getOs()); } if (updateInstanceRequest.getAmiId() != null) { jsonWriter.key("AmiId").value(updateInstanceRequest.getAmiId()); } if (updateInstanceRequest.getSshKeyName() != null) { jsonWriter.key("SshKeyName").value(updateInstanceRequest.getSshKeyName()); } if (updateInstanceRequest.getArchitecture() != null) { jsonWriter.key("Architecture").value(updateInstanceRequest.getArchitecture()); } if (updateInstanceRequest.isInstallUpdatesOnBoot() != null) { jsonWriter .key("InstallUpdatesOnBoot") .value(updateInstanceRequest.isInstallUpdatesOnBoot()); } if (updateInstanceRequest.isEbsOptimized() != null) { jsonWriter.key("EbsOptimized").value(updateInstanceRequest.isEbsOptimized()); } 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; }