public Request<DeleteReusableDelegationSetRequest> marshall( DeleteReusableDelegationSetRequest deleteReusableDelegationSetRequest) { if (deleteReusableDelegationSetRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteReusableDelegationSetRequest> request = new DefaultRequest<DeleteReusableDelegationSetRequest>( deleteReusableDelegationSetRequest, "AmazonRoute53"); request.setHttpMethod(HttpMethodName.DELETE); String uriResourcePath = "/2013-04-01/delegationset/{Id}"; uriResourcePath = uriResourcePath.replace( "{Id}", (deleteReusableDelegationSetRequest.getId() == null) ? "" : StringUtils.fromString(deleteReusableDelegationSetRequest.getId())); request.setResourcePath(uriResourcePath); return request; }
public Request<CreateRoleRequest> marshall(CreateRoleRequest createRoleRequest) { if (createRoleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateRoleRequest> request = new DefaultRequest<CreateRoleRequest>(createRoleRequest, "AmazonIdentityManagement"); request.addParameter("Action", "CreateRole"); request.addParameter("Version", "2010-05-08"); request.setHttpMethod(HttpMethodName.POST); if (createRoleRequest.getPath() != null) { request.addParameter("Path", StringUtils.fromString(createRoleRequest.getPath())); } if (createRoleRequest.getRoleName() != null) { request.addParameter("RoleName", StringUtils.fromString(createRoleRequest.getRoleName())); } if (createRoleRequest.getAssumeRolePolicyDocument() != null) { request.addParameter( "AssumeRolePolicyDocument", StringUtils.fromString(createRoleRequest.getAssumeRolePolicyDocument())); } return request; }
public Request<DeleteNotificationConfigurationRequest> marshall( DeleteNotificationConfigurationRequest deleteNotificationConfigurationRequest) { if (deleteNotificationConfigurationRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteNotificationConfigurationRequest> request = new DefaultRequest<DeleteNotificationConfigurationRequest>( deleteNotificationConfigurationRequest, "AmazonAutoScaling"); request.addParameter("Action", "DeleteNotificationConfiguration"); request.addParameter("Version", "2011-01-01"); request.setHttpMethod(HttpMethodName.POST); if (deleteNotificationConfigurationRequest.getAutoScalingGroupName() != null) { request.addParameter( "AutoScalingGroupName", StringUtils.fromString(deleteNotificationConfigurationRequest.getAutoScalingGroupName())); } if (deleteNotificationConfigurationRequest.getTopicARN() != null) { request.addParameter( "TopicARN", StringUtils.fromString(deleteNotificationConfigurationRequest.getTopicARN())); } 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<ApplyPendingMaintenanceActionRequest> marshall( ApplyPendingMaintenanceActionRequest applyPendingMaintenanceActionRequest) { if (applyPendingMaintenanceActionRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ApplyPendingMaintenanceActionRequest> request = new DefaultRequest<ApplyPendingMaintenanceActionRequest>( applyPendingMaintenanceActionRequest, "AmazonRDS"); request.addParameter("Action", "ApplyPendingMaintenanceAction"); request.addParameter("Version", "2014-10-31"); request.setHttpMethod(HttpMethodName.POST); if (applyPendingMaintenanceActionRequest.getResourceIdentifier() != null) { request.addParameter( "ResourceIdentifier", StringUtils.fromString(applyPendingMaintenanceActionRequest.getResourceIdentifier())); } if (applyPendingMaintenanceActionRequest.getApplyAction() != null) { request.addParameter( "ApplyAction", StringUtils.fromString(applyPendingMaintenanceActionRequest.getApplyAction())); } if (applyPendingMaintenanceActionRequest.getOptInType() != null) { request.addParameter( "OptInType", StringUtils.fromString(applyPendingMaintenanceActionRequest.getOptInType())); } return request; }
public Request<ListInstanceProfilesRequest> marshall( ListInstanceProfilesRequest listInstanceProfilesRequest) { if (listInstanceProfilesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListInstanceProfilesRequest> request = new DefaultRequest<ListInstanceProfilesRequest>( listInstanceProfilesRequest, "AmazonIdentityManagement"); request.addParameter("Action", "ListInstanceProfiles"); request.addParameter("Version", "2010-05-08"); request.setHttpMethod(HttpMethodName.POST); if (listInstanceProfilesRequest.getPathPrefix() != null) { request.addParameter( "PathPrefix", StringUtils.fromString(listInstanceProfilesRequest.getPathPrefix())); } if (listInstanceProfilesRequest.getMarker() != null) { request.addParameter( "Marker", StringUtils.fromString(listInstanceProfilesRequest.getMarker())); } if (listInstanceProfilesRequest.getMaxItems() != null) { request.addParameter( "MaxItems", StringUtils.fromInteger(listInstanceProfilesRequest.getMaxItems())); } 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<DescribeStackEventsRequest> marshall( DescribeStackEventsRequest describeStackEventsRequest) { if (describeStackEventsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeStackEventsRequest> request = new DefaultRequest<DescribeStackEventsRequest>( describeStackEventsRequest, "AmazonCloudFormation"); request.addParameter("Action", "DescribeStackEvents"); request.addParameter("Version", "2010-05-15"); request.setHttpMethod(HttpMethodName.POST); if (describeStackEventsRequest.getStackName() != null) { request.addParameter( "StackName", StringUtils.fromString(describeStackEventsRequest.getStackName())); } if (describeStackEventsRequest.getNextToken() != null) { request.addParameter( "NextToken", StringUtils.fromString(describeStackEventsRequest.getNextToken())); } return request; }
public Request<StopInstancesRequest> marshall(StopInstancesRequest stopInstancesRequest) { if (stopInstancesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<StopInstancesRequest> request = new DefaultRequest<StopInstancesRequest>(stopInstancesRequest, "AmazonEC2"); request.addParameter("Action", "StopInstances"); request.addParameter("Version", "2016-04-01"); request.setHttpMethod(HttpMethodName.POST); com.amazonaws.internal.SdkInternalList<String> instanceIdsList = (com.amazonaws.internal.SdkInternalList<String>) stopInstancesRequest.getInstanceIds(); if (!instanceIdsList.isEmpty() || !instanceIdsList.isAutoConstruct()) { int instanceIdsListIndex = 1; for (String instanceIdsListValue : instanceIdsList) { if (instanceIdsListValue != null) { request.addParameter( "InstanceId." + instanceIdsListIndex, StringUtils.fromString(instanceIdsListValue)); } instanceIdsListIndex++; } } if (stopInstancesRequest.getForce() != null) { request.addParameter("Force", StringUtils.fromBoolean(stopInstancesRequest.getForce())); } return request; }
public Request<DeleteLifecycleHookRequest> marshall( DeleteLifecycleHookRequest deleteLifecycleHookRequest) { if (deleteLifecycleHookRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DeleteLifecycleHookRequest> request = new DefaultRequest<DeleteLifecycleHookRequest>( deleteLifecycleHookRequest, "AmazonAutoScaling"); request.addParameter("Action", "DeleteLifecycleHook"); request.addParameter("Version", "2011-01-01"); request.setHttpMethod(HttpMethodName.POST); if (deleteLifecycleHookRequest.getLifecycleHookName() != null) { request.addParameter( "LifecycleHookName", StringUtils.fromString(deleteLifecycleHookRequest.getLifecycleHookName())); } if (deleteLifecycleHookRequest.getAutoScalingGroupName() != null) { request.addParameter( "AutoScalingGroupName", StringUtils.fromString(deleteLifecycleHookRequest.getAutoScalingGroupName())); } return request; }
public Request<DescribeInstanceAttributeRequest> marshall( DescribeInstanceAttributeRequest describeInstanceAttributeRequest) { if (describeInstanceAttributeRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeInstanceAttributeRequest> request = new DefaultRequest<DescribeInstanceAttributeRequest>( describeInstanceAttributeRequest, "AmazonEC2"); request.addParameter("Action", "DescribeInstanceAttribute"); request.addParameter("Version", "2015-10-01"); request.setHttpMethod(HttpMethodName.POST); if (describeInstanceAttributeRequest.getInstanceId() != null) { request.addParameter( "InstanceId", StringUtils.fromString(describeInstanceAttributeRequest.getInstanceId())); } if (describeInstanceAttributeRequest.getAttribute() != null) { request.addParameter( "Attribute", StringUtils.fromString(describeInstanceAttributeRequest.getAttribute())); } 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<PutIdentityPolicyRequest> marshall( PutIdentityPolicyRequest putIdentityPolicyRequest) { if (putIdentityPolicyRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<PutIdentityPolicyRequest> request = new DefaultRequest<PutIdentityPolicyRequest>( putIdentityPolicyRequest, "AmazonSimpleEmailService"); request.addParameter("Action", "PutIdentityPolicy"); request.addParameter("Version", "2010-12-01"); request.setHttpMethod(HttpMethodName.POST); if (putIdentityPolicyRequest.getIdentity() != null) { request.addParameter( "Identity", StringUtils.fromString(putIdentityPolicyRequest.getIdentity())); } if (putIdentityPolicyRequest.getPolicyName() != null) { request.addParameter( "PolicyName", StringUtils.fromString(putIdentityPolicyRequest.getPolicyName())); } if (putIdentityPolicyRequest.getPolicy() != null) { request.addParameter("Policy", StringUtils.fromString(putIdentityPolicyRequest.getPolicy())); } 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<DeleteEnvironmentConfigurationRequest> marshall( DeleteEnvironmentConfigurationRequest deleteEnvironmentConfigurationRequest) { if (deleteEnvironmentConfigurationRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DeleteEnvironmentConfigurationRequest> request = new DefaultRequest<DeleteEnvironmentConfigurationRequest>( deleteEnvironmentConfigurationRequest, "AWSElasticBeanstalk"); request.addParameter("Action", "DeleteEnvironmentConfiguration"); request.addParameter("Version", "2010-12-01"); request.setHttpMethod(HttpMethodName.POST); if (deleteEnvironmentConfigurationRequest.getApplicationName() != null) { request.addParameter( "ApplicationName", StringUtils.fromString(deleteEnvironmentConfigurationRequest.getApplicationName())); } if (deleteEnvironmentConfigurationRequest.getEnvironmentName() != null) { request.addParameter( "EnvironmentName", StringUtils.fromString(deleteEnvironmentConfigurationRequest.getEnvironmentName())); } return request; }
public Request<UpdateUserRequest> marshall(UpdateUserRequest updateUserRequest) { if (updateUserRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<UpdateUserRequest> request = new DefaultRequest<UpdateUserRequest>(updateUserRequest, "AmazonIdentityManagement"); request.addParameter("Action", "UpdateUser"); request.addParameter("Version", "2010-05-08"); request.setHttpMethod(HttpMethodName.POST); if (updateUserRequest.getUserName() != null) { request.addParameter("UserName", StringUtils.fromString(updateUserRequest.getUserName())); } if (updateUserRequest.getNewPath() != null) { request.addParameter("NewPath", StringUtils.fromString(updateUserRequest.getNewPath())); } if (updateUserRequest.getNewUserName() != null) { request.addParameter( "NewUserName", StringUtils.fromString(updateUserRequest.getNewUserName())); } return request; }
public Request<AddClientIDToOpenIDConnectProviderRequest> marshall( AddClientIDToOpenIDConnectProviderRequest addClientIDToOpenIDConnectProviderRequest) { if (addClientIDToOpenIDConnectProviderRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<AddClientIDToOpenIDConnectProviderRequest> request = new DefaultRequest<AddClientIDToOpenIDConnectProviderRequest>( addClientIDToOpenIDConnectProviderRequest, "AmazonIdentityManagement"); request.addParameter("Action", "AddClientIDToOpenIDConnectProvider"); request.addParameter("Version", "2010-05-08"); request.setHttpMethod(HttpMethodName.POST); if (addClientIDToOpenIDConnectProviderRequest.getOpenIDConnectProviderArn() != null) { request.addParameter( "OpenIDConnectProviderArn", StringUtils.fromString( addClientIDToOpenIDConnectProviderRequest.getOpenIDConnectProviderArn())); } if (addClientIDToOpenIDConnectProviderRequest.getClientID() != null) { request.addParameter( "ClientID", StringUtils.fromString(addClientIDToOpenIDConnectProviderRequest.getClientID())); } 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<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<DescribeLoadBalancersRequest> marshall( DescribeLoadBalancersRequest describeLoadBalancersRequest) { if (describeLoadBalancersRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeLoadBalancersRequest> request = new DefaultRequest<DescribeLoadBalancersRequest>( describeLoadBalancersRequest, "AmazonAutoScaling"); request.addParameter("Action", "DescribeLoadBalancers"); request.addParameter("Version", "2011-01-01"); request.setHttpMethod(HttpMethodName.POST); if (describeLoadBalancersRequest.getAutoScalingGroupName() != null) { request.addParameter( "AutoScalingGroupName", StringUtils.fromString(describeLoadBalancersRequest.getAutoScalingGroupName())); } if (describeLoadBalancersRequest.getNextToken() != null) { request.addParameter( "NextToken", StringUtils.fromString(describeLoadBalancersRequest.getNextToken())); } if (describeLoadBalancersRequest.getMaxRecords() != null) { request.addParameter( "MaxRecords", StringUtils.fromInteger(describeLoadBalancersRequest.getMaxRecords())); } 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<ChangeMessageVisibilityRequest> marshall( ChangeMessageVisibilityRequest changeMessageVisibilityRequest) { if (changeMessageVisibilityRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ChangeMessageVisibilityRequest> request = new DefaultRequest<ChangeMessageVisibilityRequest>( changeMessageVisibilityRequest, "AmazonSQS"); request.addParameter("Action", "ChangeMessageVisibility"); request.addParameter("Version", "2012-11-05"); request.setHttpMethod(HttpMethodName.POST); if (changeMessageVisibilityRequest.getQueueUrl() != null) { request.addParameter( "QueueUrl", StringUtils.fromString(changeMessageVisibilityRequest.getQueueUrl())); } if (changeMessageVisibilityRequest.getReceiptHandle() != null) { request.addParameter( "ReceiptHandle", StringUtils.fromString(changeMessageVisibilityRequest.getReceiptHandle())); } if (changeMessageVisibilityRequest.getVisibilityTimeout() != null) { request.addParameter( "VisibilityTimeout", StringUtils.fromInteger(changeMessageVisibilityRequest.getVisibilityTimeout())); } 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<GetHostedZoneRequest> marshall(GetHostedZoneRequest getHostedZoneRequest) { if (getHostedZoneRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<GetHostedZoneRequest> request = new DefaultRequest<GetHostedZoneRequest>(getHostedZoneRequest, "AmazonRoute53"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/2012-02-29/hostedzone/{Id}"; uriResourcePath = uriResourcePath.replace("{Id}", getString(getHostedZoneRequest.getId())); 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); 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<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<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<ListCloudFrontOriginAccessIdentitiesRequest> marshall( ListCloudFrontOriginAccessIdentitiesRequest listCloudFrontOriginAccessIdentitiesRequest) { if (listCloudFrontOriginAccessIdentitiesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListCloudFrontOriginAccessIdentitiesRequest> request = new DefaultRequest<ListCloudFrontOriginAccessIdentitiesRequest>( listCloudFrontOriginAccessIdentitiesRequest, "AmazonCloudFront"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/2016-01-28/origin-access-identity/cloudfront"; request.setResourcePath(uriResourcePath); if (listCloudFrontOriginAccessIdentitiesRequest.getMarker() != null) { request.addParameter( "Marker", StringUtils.fromString(listCloudFrontOriginAccessIdentitiesRequest.getMarker())); } if (listCloudFrontOriginAccessIdentitiesRequest.getMaxItems() != null) { request.addParameter( "MaxItems", StringUtils.fromString(listCloudFrontOriginAccessIdentitiesRequest.getMaxItems())); } 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; }