-- |

module TestUtils.S3Utils
  ( s3Copy
  , s3RecursiveRm
  ) where

import           System.Process (callCommand)

-- Copy a file, possibly from and/or to S3
s3Copy :: String -> String -> IO ()
s3Copy :: String -> String -> IO ()
s3Copy String
from String
to = String -> IO ()
callCommand String
cmd where cmd :: String
cmd = String
"aws s3 cp " forall a. [a] -> [a] -> [a]
++ String
from forall a. [a] -> [a] -> [a]
++ String
" " forall a. [a] -> [a] -> [a]
++ String
to

-- Delete all objects in S3 starting with the prefix `uri`
s3RecursiveRm :: String -> IO ()
s3RecursiveRm :: String -> IO ()
s3RecursiveRm String
uri = String -> IO ()
callCommand String
cmd
  where cmd :: String
cmd = String
"aws s3 rm --recursive " forall a. [a] -> [a] -> [a]
++ String
uri