List of usage examples for com.amazonaws AmazonClientException AmazonClientException
public AmazonClientException(Throwable t)
From source file:com.github.sjones4.youcan.youtoken.model.transform.GetAccessTokenRequestMarshaller.java
License:Open Source License
public Request<GetAccessTokenRequest> marshall(GetAccessTokenRequest getAccessTokenRequest) { if (getAccessTokenRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); }/*ww w . ja v a2 s . co m*/ Request<GetAccessTokenRequest> request = new DefaultRequest<GetAccessTokenRequest>(getAccessTokenRequest, "AWSSecurityTokenService"); request.addParameter("Action", "GetAccessToken"); request.addParameter("Version", "2011-06-15"); if (getAccessTokenRequest.getDurationSeconds() != null) { request.addParameter("DurationSeconds", StringUtils.fromInteger(getAccessTokenRequest.getDurationSeconds())); } return request; }
From source file:com.github.sjones4.youcan.youtoken.model.transform.GetImpersonationTokenRequestMarshaller.java
License:Open Source License
public Request<GetImpersonationTokenRequest> marshall( GetImpersonationTokenRequest getImpersonationTokenRequest) { if (getImpersonationTokenRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); }/* www . ja v a 2 s .c om*/ Request<GetImpersonationTokenRequest> request = new DefaultRequest<GetImpersonationTokenRequest>( getImpersonationTokenRequest, "AWSSecurityTokenService"); request.addParameter("Action", "GetImpersonationToken"); request.addParameter("Version", "2011-06-15"); if (getImpersonationTokenRequest.getAccountAlias() != null) { request.addParameter("AccountAlias", StringUtils.fromString(getImpersonationTokenRequest.getAccountAlias())); } if (getImpersonationTokenRequest.getUserName() != null) { request.addParameter("UserName", StringUtils.fromString(getImpersonationTokenRequest.getUserName())); } if (getImpersonationTokenRequest.getUserId() != null) { request.addParameter("UserId", StringUtils.fromString(getImpersonationTokenRequest.getUserId())); } return request; }
From source file:com.github.sjones4.youcan.youtwo.model.transform.DescribeInstanceTypesRequestMarshaller.java
License:Open Source License
public Request<DescribeInstanceTypesRequest> marshall( DescribeInstanceTypesRequest describeInstanceTypesRequest) { if (describeInstanceTypesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); }//w w w . j av a2 s .c om Request<DescribeInstanceTypesRequest> request = new DefaultRequest<>(describeInstanceTypesRequest, "AmazonEC2"); request.addParameter("Action", "DescribeInstanceTypes"); request.addParameter("Version", "2013-10-15"); List<String> instanceTypesList = describeInstanceTypesRequest.getInstanceTypes(); int instanceTypesListIndex = 1; for (String instanceTypesListValue : instanceTypesList) { if (instanceTypesListValue != null) { request.addParameter("InstanceType." + instanceTypesListIndex, StringUtils.fromString(instanceTypesListValue)); } instanceTypesListIndex++; } if (describeInstanceTypesRequest.getAvailability() != null) { request.addParameter("Availability", StringUtils.fromBoolean(describeInstanceTypesRequest.getAvailability())); } if (describeInstanceTypesRequest.getVerbose() != null) { request.addParameter("Verbose", StringUtils.fromBoolean(describeInstanceTypesRequest.getVerbose())); } return request; }
From source file:com.github.sjones4.youcan.youtwo.model.transform.ModifyInstanceTypeAttributeRequestMarshaller.java
License:Open Source License
@Override public Request<ModifyInstanceTypeAttributeRequest> marshall( final ModifyInstanceTypeAttributeRequest modifyInstanceTypeRequest) { if (modifyInstanceTypeRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); }/*from w ww .j a va2 s. co m*/ Request<ModifyInstanceTypeAttributeRequest> request = new DefaultRequest<>(modifyInstanceTypeRequest, "AmazonEC2"); request.addParameter("Action", "ModifyInstanceTypeAttribute"); request.addParameter("Version", "2013-10-15"); if (modifyInstanceTypeRequest.getName() != null) { request.addParameter("Name", StringUtils.fromString(modifyInstanceTypeRequest.getName())); } if (modifyInstanceTypeRequest.getCpu() != null) { request.addParameter("Cpu", StringUtils.fromInteger(modifyInstanceTypeRequest.getCpu())); } if (modifyInstanceTypeRequest.getDisk() != null) { request.addParameter("Disk", StringUtils.fromInteger(modifyInstanceTypeRequest.getDisk())); } if (modifyInstanceTypeRequest.getMemory() != null) { request.addParameter("Memory", StringUtils.fromInteger(modifyInstanceTypeRequest.getMemory())); } return request; }
From source file:com.ibm.og.s3.v4.DecodedStreamBuffer.java
License:Open Source License
public void startReadBuffer() { if (this.bufferSizeOverflow) { throw new AmazonClientException("The input stream is not repeatable since the buffer size " + this.maxBufferSize + " has been exceeded."); }/* ww w. ja v a 2s. co m*/ this.pos = 0; }
From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechGetRequestMarshaller.java
License:Open Source License
public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) { if (createSpeechRequest == null) { throw new AmazonClientException("null createSpeechRequest passed to marshall(...)"); }/*from www . ja va 2 s .c om*/ Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest, IvonaSpeechCloudClient.SERVICE_NAME); setRequestParameters(request, createSpeechRequest); request.setHttpMethod(HttpMethodName.GET); request.setResourcePath(RESOURCE_PATH); return request; }
From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechPostRequestMarshaller.java
License:Open Source License
public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) { if (createSpeechRequest == null) { throw new AmazonClientException("null createSpeechRequest passed to marshall(...)"); }//w w w . j ava 2 s . co m Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest, IvonaSpeechCloudClient.SERVICE_NAME); request.setHttpMethod(HttpMethodName.POST); setRequestPayload(request, createSpeechRequest); request.setResourcePath(RESOURCE_PATH); return request; }
From source file:com.ivona.services.tts.model.transform.lexicons.DeleteLexiconPostRequestMarshaller.java
License:Open Source License
public Request<DeleteLexiconRequest> marshall(DeleteLexiconRequest deleteLexiconRequest) { if (deleteLexiconRequest == null) { throw new AmazonClientException("null deleteLexiconRequest passed to marshall(...)"); }// ww w . j a v a 2 s .c om Request<DeleteLexiconRequest> request = new DefaultRequest<DeleteLexiconRequest>(deleteLexiconRequest, IvonaSpeechCloudClient.SERVICE_NAME); request.setHttpMethod(HttpMethodName.POST); setRequestPayload(request, deleteLexiconRequest); request.setResourcePath(RESOURCE_PATH); return request; }
From source file:com.ivona.services.tts.model.transform.lexicons.DeleteLexiconPostRequestMarshaller.java
License:Open Source License
private void setRequestPayload(Request<DeleteLexiconRequest> request, DeleteLexiconRequest deleteLexiconRequest) { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); try {/*www . j ava2 s . c om*/ jsonWriter.object(); if (MarshallerHelper.stringIsNotBlank(deleteLexiconRequest.getLexiconName())) { jsonWriter.key("Name").value(deleteLexiconRequest.getLexiconName()); } else { throw new AmazonClientException("null or empty lexicon name passed to marshall(...)"); } 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 (JSONException e) { throw new AmazonClientException("Unable to marshall request to JSON", e); } catch (UnsupportedEncodingException e) { throw new AmazonClientException("Unable to marshall request to JSON", e); } }
From source file:com.ivona.services.tts.model.transform.lexicons.GetLexiconPostRequestMarshaller.java
License:Open Source License
public Request<GetLexiconRequest> marshall(GetLexiconRequest getLexiconRequest) { if (getLexiconRequest == null) { throw new AmazonClientException("null getLexiconRequest passed to marshall(...)"); }//w w w .j av a 2s . c o m Request<GetLexiconRequest> request = new DefaultRequest<GetLexiconRequest>(getLexiconRequest, IvonaSpeechCloudClient.SERVICE_NAME); request.setHttpMethod(HttpMethodName.POST); setRequestPayload(request, getLexiconRequest); request.setResourcePath(RESOURCE_PATH); return request; }