public Request<ListPolicyVersionsRequest> marshall( ListPolicyVersionsRequest listPolicyVersionsRequest) { if (listPolicyVersionsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListPolicyVersionsRequest> request = new DefaultRequest<ListPolicyVersionsRequest>(listPolicyVersionsRequest, "AWSIot"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/policies/{policyName}/version"; uriResourcePath = uriResourcePath.replace( "{policyName}", (listPolicyVersionsRequest.getPolicyName() == null) ? "" : StringUtils.fromString(listPolicyVersionsRequest.getPolicyName())); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<DeleteVaultNotificationsRequest> marshall( DeleteVaultNotificationsRequest deleteVaultNotificationsRequest) { if (deleteVaultNotificationsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DeleteVaultNotificationsRequest> request = new DefaultRequest<DeleteVaultNotificationsRequest>( deleteVaultNotificationsRequest, "AmazonGlacier"); request.setHttpMethod(HttpMethodName.DELETE); String uriResourcePath = "/{accountId}/vaults/{vaultName}/notification-configuration"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "accountId", deleteVaultNotificationsRequest.getAccountId() == null ? "-" : deleteVaultNotificationsRequest.getAccountId()); uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "vaultName", deleteVaultNotificationsRequest.getVaultName()); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } return request; }
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<PublishRequest> marshall(PublishRequest publishRequest) { if (publishRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<PublishRequest> request = new DefaultRequest<PublishRequest>(publishRequest, "AWSIotData"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/topics/{topic}"; uriResourcePath = uriResourcePath.replace( "{topic}", (publishRequest.getTopic() == null) ? "" : StringUtils.fromString(publishRequest.getTopic())); request.setResourcePath(uriResourcePath); String qos = (publishRequest.getQos() == null) ? null : StringUtils.fromInteger(publishRequest.getQos()); if (qos != null) { request.addParameter("qos", qos); } request.setContent(BinaryUtils.toStream(publishRequest.getPayload())); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
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<PurchaseProvisionedCapacityRequest> marshall( PurchaseProvisionedCapacityRequest purchaseProvisionedCapacityRequest) { if (purchaseProvisionedCapacityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<PurchaseProvisionedCapacityRequest> request = new DefaultRequest<PurchaseProvisionedCapacityRequest>( purchaseProvisionedCapacityRequest, "AmazonGlacier"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/{accountId}/provisioned-capacity"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "accountId", purchaseProvisionedCapacityRequest.getAccountId() == null ? "-" : purchaseProvisionedCapacityRequest.getAccountId()); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } return request; }
public Request<DetachThingPrincipalRequest> marshall( DetachThingPrincipalRequest detachThingPrincipalRequest) { if (detachThingPrincipalRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DetachThingPrincipalRequest> request = new DefaultRequest<DetachThingPrincipalRequest>(detachThingPrincipalRequest, "AWSIot"); request.setHttpMethod(HttpMethodName.DELETE); if (detachThingPrincipalRequest.getPrincipal() != null) { request.addHeader( "x-amzn-principal", StringUtils.fromString(detachThingPrincipalRequest.getPrincipal())); } String uriResourcePath = "/things/{thingName}/principals"; uriResourcePath = uriResourcePath.replace( "{thingName}", (detachThingPrincipalRequest.getThingName() == null) ? "" : StringUtils.fromString(detachThingPrincipalRequest.getThingName())); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", "binary/octet-stream"); } return request; }
public Request<DisableTopicRuleRequest> marshall( DisableTopicRuleRequest disableTopicRuleRequest) { if (disableTopicRuleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DisableTopicRuleRequest> request = new DefaultRequest<DisableTopicRuleRequest>(disableTopicRuleRequest, "AWSIot"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/rules/{ruleName}/disable"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "ruleName", disableTopicRuleRequest.getRuleName()); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } return request; }
public Request<DeleteElasticsearchDomainRequest> marshall( DeleteElasticsearchDomainRequest deleteElasticsearchDomainRequest) { if (deleteElasticsearchDomainRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteElasticsearchDomainRequest> request = new DefaultRequest<DeleteElasticsearchDomainRequest>( deleteElasticsearchDomainRequest, "AWSElasticsearch"); request.setHttpMethod(HttpMethodName.DELETE); String uriResourcePath = "/2015-01-01/es/domain/{DomainName}"; uriResourcePath = uriResourcePath.replace( "{DomainName}", (deleteElasticsearchDomainRequest.getDomainName() == null) ? "" : StringUtils.fromString(deleteElasticsearchDomainRequest.getDomainName())); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", "binary/octet-stream"); } return request; }
public Request<InvokeAsyncRequest> marshall(InvokeAsyncRequest invokeAsyncRequest) { if (invokeAsyncRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<InvokeAsyncRequest> request = new DefaultRequest<InvokeAsyncRequest>(invokeAsyncRequest, "AWSLambda"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/2014-11-13/functions/{FunctionName}/invoke-async/"; uriResourcePath = uriResourcePath.replace( "{FunctionName}", (invokeAsyncRequest.getFunctionName() != null) ? StringUtils.fromString(invokeAsyncRequest.getFunctionName()) : ""); request.setResourcePath(uriResourcePath); request.setContent(invokeAsyncRequest.getInvokeArgs()); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<DeleteTopicRuleRequest> marshall(DeleteTopicRuleRequest deleteTopicRuleRequest) { if (deleteTopicRuleRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteTopicRuleRequest> request = new DefaultRequest<DeleteTopicRuleRequest>(deleteTopicRuleRequest, "AWSIot"); request.setHttpMethod(HttpMethodName.DELETE); String uriResourcePath = "/rules/{ruleName}"; uriResourcePath = uriResourcePath.replace( "{ruleName}", (deleteTopicRuleRequest.getRuleName() != null) ? StringUtils.fromString(deleteTopicRuleRequest.getRuleName()) : ""); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<DescribeAccountAttributesRequest> marshall( DescribeAccountAttributesRequest describeAccountAttributesRequest) { if (describeAccountAttributesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DescribeAccountAttributesRequest> request = new DefaultRequest<DescribeAccountAttributesRequest>( describeAccountAttributesRequest, "AWSOpsWorksCM"); request.addHeader("X-Amz-Target", "OpsWorksCM_V2016_11_01.DescribeAccountAttributes"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); 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<ListTablesRequest> marshall(ListTablesRequest listTablesRequest) { if (listTablesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListTablesRequest> request = new DefaultRequest<ListTablesRequest>(listTablesRequest, "AmazonDynamoDBv2"); String target = "DynamoDB_20120810.ListTables"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); 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 (listTablesRequest.getExclusiveStartTableName() != null) { jsonWriter .key("ExclusiveStartTableName") .value(listTablesRequest.getExclusiveStartTableName()); } if (listTablesRequest.getLimit() != null) { jsonWriter.key("Limit").value(listTablesRequest.getLimit()); } 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<DetachPrincipalPolicyRequest> marshall( DetachPrincipalPolicyRequest detachPrincipalPolicyRequest) { if (detachPrincipalPolicyRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DetachPrincipalPolicyRequest> request = new DefaultRequest<DetachPrincipalPolicyRequest>(detachPrincipalPolicyRequest, "AWSIot"); request.setHttpMethod(HttpMethodName.DELETE); if (detachPrincipalPolicyRequest.getPrincipal() != null) { request.addHeader( "x-amzn-iot-principal", StringUtils.fromString(detachPrincipalPolicyRequest.getPrincipal())); } String uriResourcePath = "/principal-policies/{policyName}"; uriResourcePath = uriResourcePath.replace( "{policyName}", (detachPrincipalPolicyRequest.getPolicyName() == null) ? "" : StringUtils.fromString(detachPrincipalPolicyRequest.getPolicyName())); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<GetStagesRequest> marshall(GetStagesRequest getStagesRequest) { if (getStagesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<GetStagesRequest> request = new DefaultRequest<GetStagesRequest>(getStagesRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/restapis/{restapi_id}/stages"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "restapi_id", getStagesRequest.getRestApiId()); request.setResourcePath(uriResourcePath); if (getStagesRequest.getDeploymentId() != null) { request.addParameter( "deploymentId", StringUtils.fromString(getStagesRequest.getDeploymentId())); } request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } return request; }
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; }
public Request<CancelJobRequest> marshall(CancelJobRequest cancelJobRequest) { if (cancelJobRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CancelJobRequest> request = new DefaultRequest<CancelJobRequest>(cancelJobRequest, "AmazonSnowball"); request.addHeader("X-Amz-Target", "AWSIESnowballJobManagementService.CancelJob"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (cancelJobRequest.getJobId() != null) { jsonGenerator.writeFieldName("JobId").writeValue(cancelJobRequest.getJobId()); } 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<FlushStageCacheRequest> marshall(FlushStageCacheRequest flushStageCacheRequest) { if (flushStageCacheRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<FlushStageCacheRequest> request = new DefaultRequest<FlushStageCacheRequest>(flushStageCacheRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.DELETE); String uriResourcePath = "/restapis/{restapi_id}/stages/{stage_name}/cache/data"; uriResourcePath = uriResourcePath.replace( "{restapi_id}", (flushStageCacheRequest.getRestApiId() == null) ? "" : StringUtils.fromString(flushStageCacheRequest.getRestApiId())); uriResourcePath = uriResourcePath.replace( "{stage_name}", (flushStageCacheRequest.getStageName() == null) ? "" : StringUtils.fromString(flushStageCacheRequest.getStageName())); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<GetThingShadowRequest> marshall(GetThingShadowRequest getThingShadowRequest) { if (getThingShadowRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<GetThingShadowRequest> request = new DefaultRequest<GetThingShadowRequest>(getThingShadowRequest, "AWSIotData"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/things/{thingName}/shadow"; uriResourcePath = uriResourcePath.replace( "{thingName}", (getThingShadowRequest.getThingName() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getThingShadowRequest.getThingName()), false) : ""); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } return request; }
public Request<DeleteMountTargetRequest> marshall( DeleteMountTargetRequest deleteMountTargetRequest) { if (deleteMountTargetRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteMountTargetRequest> request = new DefaultRequest<DeleteMountTargetRequest>( deleteMountTargetRequest, "AmazonElasticFileSystem"); request.setHttpMethod(HttpMethodName.DELETE); String uriResourcePath = "/2015-02-01/mount-targets/{MountTargetId}"; uriResourcePath = uriResourcePath.replace( "{MountTargetId}", (deleteMountTargetRequest.getMountTargetId() == null) ? "" : StringUtils.fromString(deleteMountTargetRequest.getMountTargetId())); request.setResourcePath(uriResourcePath); request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<DeletePipelineRequest> marshall(DeletePipelineRequest deletePipelineRequest) { if (deletePipelineRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DeletePipelineRequest> request = new DefaultRequest<DeletePipelineRequest>(deletePipelineRequest, "AWSCodePipeline"); request.addHeader("X-Amz-Target", "CodePipeline_20150709.DeletePipeline"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (deletePipelineRequest.getName() != null) { jsonGenerator.writeFieldName("name").writeValue(deletePipelineRequest.getName()); } 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<TerminateProvisionedProductRequest> marshall( TerminateProvisionedProductRequest terminateProvisionedProductRequest) { if (terminateProvisionedProductRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<TerminateProvisionedProductRequest> request = new DefaultRequest<TerminateProvisionedProductRequest>( terminateProvisionedProductRequest, "AWSServiceCatalog"); request.addHeader("X-Amz-Target", "AWS242ServiceCatalogService.TerminateProvisionedProduct"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (terminateProvisionedProductRequest.getProvisionedProductName() != null) { jsonGenerator .writeFieldName("ProvisionedProductName") .writeValue(terminateProvisionedProductRequest.getProvisionedProductName()); } if (terminateProvisionedProductRequest.getProvisionedProductId() != null) { jsonGenerator .writeFieldName("ProvisionedProductId") .writeValue(terminateProvisionedProductRequest.getProvisionedProductId()); } jsonGenerator .writeFieldName("TerminateToken") .writeValue( IdempotentUtils.resolveString( terminateProvisionedProductRequest.getTerminateToken())); if (terminateProvisionedProductRequest.getIgnoreErrors() != null) { jsonGenerator .writeFieldName("IgnoreErrors") .writeValue(terminateProvisionedProductRequest.getIgnoreErrors()); } if (terminateProvisionedProductRequest.getAcceptLanguage() != null) { jsonGenerator .writeFieldName("AcceptLanguage") .writeValue(terminateProvisionedProductRequest.getAcceptLanguage()); } 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<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<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; }
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<CreateSnapshotRequest> marshall(CreateSnapshotRequest createSnapshotRequest) { if (createSnapshotRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateSnapshotRequest> request = new DefaultRequest<CreateSnapshotRequest>(createSnapshotRequest, "AWSStorageGateway"); String target = "StorageGateway_20130630.CreateSnapshot"; 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 (createSnapshotRequest.getVolumeARN() != null) { jsonWriter.key("VolumeARN").value(createSnapshotRequest.getVolumeARN()); } if (createSnapshotRequest.getSnapshotDescription() != null) { jsonWriter.key("SnapshotDescription").value(createSnapshotRequest.getSnapshotDescription()); } 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<ListJobsByStatusRequest> marshall( ListJobsByStatusRequest listJobsByStatusRequest) { if (listJobsByStatusRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListJobsByStatusRequest> request = new DefaultRequest<ListJobsByStatusRequest>( listJobsByStatusRequest, "AmazonElasticTranscoder"); String target = "EtsCustomerService.ListJobsByStatus"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "2012-09-25/jobsByStatus/{Status}?Ascending={Ascending};PageToken={PageToken}"; uriResourcePath = uriResourcePath.replace( "{Status}", (listJobsByStatusRequest.getStatus() == null) ? "" : StringUtils.fromString(listJobsByStatusRequest.getStatus())); uriResourcePath = uriResourcePath.replace( "{Ascending}", (listJobsByStatusRequest.getAscending() == null) ? "" : StringUtils.fromString(listJobsByStatusRequest.getAscending())); uriResourcePath = uriResourcePath.replace( "{PageToken}", (listJobsByStatusRequest.getPageToken() == null) ? "" : StringUtils.fromString(listJobsByStatusRequest.getPageToken())); 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); request.setContent(new ByteArrayInputStream(new byte[0])); return request; }
public Request<GetExportRequest> marshall(GetExportRequest getExportRequest) { if (getExportRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<GetExportRequest> request = new DefaultRequest<GetExportRequest>(getExportRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.GET); if (getExportRequest.getAccepts() != null) { request.addHeader("Accept", StringUtils.fromString(getExportRequest.getAccepts())); } String uriResourcePath = "/restapis/{restapi_id}/stages/{stage_name}/exports/{export_type}"; uriResourcePath = uriResourcePath.replace( "{restapi_id}", (getExportRequest.getRestApiId() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getExportRequest.getRestApiId()), false) : ""); uriResourcePath = uriResourcePath.replace( "{stage_name}", (getExportRequest.getStageName() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getExportRequest.getStageName()), false) : ""); uriResourcePath = uriResourcePath.replace( "{export_type}", (getExportRequest.getExportType() != null) ? SdkHttpUtils.urlEncode( StringUtils.fromString(getExportRequest.getExportType()), false) : ""); request.setResourcePath(uriResourcePath); java.util.Map<String, String> parameters = getExportRequest.getParameters(); if (parameters != null) { for (Map.Entry<String, String> entry : parameters.entrySet()) { if (entry.getValue() != null) { request.addParameter( StringUtils.fromString(entry.getKey()), StringUtils.fromString(entry.getValue())); } } } request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; }
public Request<CreateHsmRequest> marshall(CreateHsmRequest createHsmRequest) { if (createHsmRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateHsmRequest> request = new DefaultRequest<CreateHsmRequest>(createHsmRequest, "AWSCloudHSM"); String target = "CloudHsmFrontendService.CreateHsm"; 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 (createHsmRequest.getSubnetId() != null) { jsonWriter.key("SubnetId").value(createHsmRequest.getSubnetId()); } if (createHsmRequest.getSshKey() != null) { jsonWriter.key("SshKey").value(createHsmRequest.getSshKey()); } if (createHsmRequest.getEniIp() != null) { jsonWriter.key("EniIp").value(createHsmRequest.getEniIp()); } if (createHsmRequest.getIamRoleArn() != null) { jsonWriter.key("IamRoleArn").value(createHsmRequest.getIamRoleArn()); } if (createHsmRequest.getExternalId() != null) { jsonWriter.key("ExternalId").value(createHsmRequest.getExternalId()); } if (createHsmRequest.getSubscriptionType() != null) { jsonWriter.key("SubscriptionType").value(createHsmRequest.getSubscriptionType()); } if (createHsmRequest.getClientToken() != null) { jsonWriter.key("ClientToken").value(createHsmRequest.getClientToken()); } if (createHsmRequest.getSyslogIp() != null) { jsonWriter.key("SyslogIp").value(createHsmRequest.getSyslogIp()); } 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; }