Class AthenaUDFHandler
- java.lang.Object
-
- com.amazonaws.athena.connector.lambda.handlers.UserDefinedFunctionHandler
-
- com.amazonaws.athena.connectors.udfs.AthenaUDFHandler
-
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestStreamHandler
public class AthenaUDFHandler extends UserDefinedFunctionHandler
-
-
Field Summary
Fields Modifier and Type Field Description static int
GCM_IV_LENGTH
static int
GCM_TAG_LENGTH
-
Constructor Summary
Constructors Constructor Description AthenaUDFHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
compress(String input)
Compresses a valid UTF-8 String using the zlib compression library.String
decompress(String input)
Decompresses a valid String that has been compressed using the zlib compression library.String
decrypt(String ciphertext, String secretName)
This method decrypts the ciphertext with a data key stored AWS Secret Manager.String
encrypt(String plaintext, String secretName)
This method encrypts the plaintext with a data key stored AWS Secret Manager.-
Methods inherited from class com.amazonaws.athena.connector.lambda.handlers.UserDefinedFunctionHandler
doHandleRequest, handleRequest, onPing, processRows
-
-
-
-
Field Detail
-
GCM_IV_LENGTH
public static final int GCM_IV_LENGTH
- See Also:
- Constant Field Values
-
GCM_TAG_LENGTH
public static final int GCM_TAG_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
compress
public String compress(String input)
Compresses a valid UTF-8 String using the zlib compression library. Encodes bytes with Base64 encoding scheme.- Parameters:
input
- the String to be compressed- Returns:
- the compressed String
-
decompress
public String decompress(String input)
Decompresses a valid String that has been compressed using the zlib compression library. Decodes bytes with Base64 decoding scheme.- Parameters:
input
- the String to be decompressed- Returns:
- the decompressed String
-
decrypt
public String decrypt(String ciphertext, String secretName)
This method decrypts the ciphertext with a data key stored AWS Secret Manager. Before using this function, create a secret in AWS Secret Manager. Do a base64 encode to your data key and convert it to string. Store it as _PLAINTEXT_ in the secret (do not include any quotes, brackets, etc). Also make sure to use DefaultEncryptionKey as the KMS key. Otherwise you would need to update athena-udfs.yaml to allow access to your KMS key.- Parameters:
ciphertext
-secretName
-- Returns:
- plaintext
-
encrypt
public String encrypt(String plaintext, String secretName)
This method encrypts the plaintext with a data key stored AWS Secret Manager. Before using this function, create a secret in AWS Secret Manager. Do a base64 encode to your data key and convert it to string. Store it as _PLAINTEXT_ in the secret (do not include any quotes, brackets, etc). Also make sure to use DefaultEncryptionKey as the KMS key. Otherwise you would need to update athena-udfs.yaml to allow access to your KMS key.- Parameters:
plaintext
-secretName
-- Returns:
- ciphertext
-
-