public class EC2RequestHandler extends AbstractRequestHandler {
@Override
public void beforeRequest(Request<?> request) {
AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
if (originalRequest instanceof ImportKeyPairRequest) {
ImportKeyPairRequest importKeyPairRequest = (ImportKeyPairRequest)originalRequest;
String publicKeyMaterial = importKeyPairRequest.getPublicKeyMaterial();
String encodedKeyMaterial = new String(Base64.encodeBase64(publicKeyMaterial.getBytes()));
request.addParameter("PublicKeyMaterial", encodedKeyMaterial);
}
// Request -> Query string marshalling for RequestSpotInstancesRequest is a little tricky since