Class AthenaUDFHandler

  • All Implemented Interfaces:
    com.amazonaws.services.lambda.runtime.RequestStreamHandler

    public class AthenaUDFHandler
    extends UserDefinedFunctionHandler
    • Constructor Detail

      • AthenaUDFHandler

        public AthenaUDFHandler()
    • 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