Package com.amazonaws

Examples of com.amazonaws.AmazonClientException


        try {
            Mac mac = Mac.getInstance(algorithm.toString());
            mac.init(new SecretKeySpec(key, algorithm.toString()));
            return mac.doFinal(data);
        } catch (Exception e) {
            throw new AmazonClientException("Unable to calculate a request signature: " + e.getMessage(), e);
        }
    }
View Full Code Here


        try {
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            md.update(text.getBytes(DEFAULT_ENCODING));
            return md.digest();
        } catch (Exception e) {
            throw new AmazonClientException("Unable to compute hash while signing request: " + e.getMessage(), e);
        }
    }
View Full Code Here

            DigestInputStream digestInputStream = new DigestInputStream(input, md);
            byte[] buffer = new byte[1024];
            while (digestInputStream.read(buffer) > -1);
            return digestInputStream.getMessageDigest().digest();
        } catch (Exception e) {
            throw new AmazonClientException("Unable to compute hash while signing request: " + e.getMessage(), e);
        }
    }
View Full Code Here

        try {
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            md.update(data);
            return md.digest();
        } catch (Exception e) {
            throw new AmazonClientException("Unable to compute hash while signing request: " + e.getMessage(), e);
        }
    }
View Full Code Here

            String encodedParameters = HttpUtils.encodeParameters(request);
            if (encodedParameters == null) return new byte[0];
            try {
                return encodedParameters.getBytes(DEFAULT_ENCODING);
            } catch (UnsupportedEncodingException e) {
                throw new AmazonClientException("Unable to encode string into bytes");
            }
        }

        return getBinaryRequestPayloadWithoutQueryParams(request);
    }
View Full Code Here

            byteArrayOutputStream.close();
            content.reset();

            return byteArrayOutputStream.toByteArray();
        } catch (Exception e) {
            throw new AmazonClientException("Unable to read request payload to sign request: " + e.getMessage(), e);
        }
    }
View Full Code Here

            String encodedParameters = HttpUtils.encodeParameters(request);
            if (encodedParameters == null) return new ByteArrayInputStream(new byte[0]);
            try {
                return new ByteArrayInputStream(encodedParameters.getBytes(DEFAULT_ENCODING));
            } catch (UnsupportedEncodingException e) {
                throw new AmazonClientException("Unable to encode string into bytes");
            }
        }

        return getBinaryRequestPayloadStreamWithoutQueryParams(request);
    }
View Full Code Here

            if (content instanceof StringInputStream) {
                return content;
            }

            if (!content.markSupported()) {
                throw new AmazonClientException("Unable to read request payload to sign request.");
            }

            return request.getContent();
        } catch (Exception e) {
            throw new AmazonClientException("Unable to read request payload to sign request: " + e.getMessage(), e);
        }
    }
View Full Code Here

     */
    protected String newString(byte[] bytes) {
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new AmazonClientException("Unable to encode bytes to String", e);
        }
    }
View Full Code Here

public class ReportInstanceStatusRequestMarshaller implements Marshaller<Request<ReportInstanceStatusRequest>, ReportInstanceStatusRequest> {

    public Request<ReportInstanceStatusRequest> marshall(ReportInstanceStatusRequest reportInstanceStatusRequest) {

        if (reportInstanceStatusRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

        Request<ReportInstanceStatusRequest> request = new DefaultRequest<ReportInstanceStatusRequest>(reportInstanceStatusRequest, "AmazonEC2");
        request.addParameter("Action", "ReportInstanceStatus");
        request.addParameter("Version", "2012-10-01");
View Full Code Here

TOP

Related Classes of com.amazonaws.AmazonClientException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.