hw-uri 0.1.1.6 → 0.1.1.7
raw patch · 4 files changed
+18/−6 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ HaskellWorks.Data.Uri.IO.Lazy: deleteResource :: MonadResource m => Env -> Location -> ExceptT UriError m ()
+ HaskellWorks.Data.Uri.UriError: DeleteFailed :: Text -> UriError
Files
- app/App/Commands/Cp.hs +5/−4
- hw-uri.cabal +1/−1
- src/HaskellWorks/Data/Uri/IO/Lazy.hs +11/−1
- src/HaskellWorks/Data/Uri/UriError.hs +1/−0
app/App/Commands/Cp.hs view
@@ -24,6 +24,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as TIO import qualified HaskellWorks.Data.Uri.IO.Lazy as URI+import qualified System.Exit as IO import qualified System.IO as IO import qualified System.IO.Unsafe as IO @@ -41,13 +42,13 @@ case lbsResult of Right lbs -> void $ URI.writeResource envAws output lbs- Left msg -> return ()-- return ()+ Left _ -> throwError "Copy failed" case result of Right _ -> return ()- Left msg -> TIO.hPutStrLn IO.stderr (displayUriError msg)+ Left msg -> do+ TIO.hPutStrLn IO.stderr (displayUriError msg)+ IO.exitFailure optsCp :: Parser Z.CpOptions optsCp = Z.CpOptions
hw-uri.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 name: hw-uri-version: 0.1.1.6+version: 0.1.1.7 synopsis: Supports IO on URIs description: Supports IO on URIs. homepage: https://github.com/haskell-works/hw-uri
src/HaskellWorks/Data/Uri/IO/Lazy.hs view
@@ -18,6 +18,7 @@ , readHttpUri , removePathRecursive , listResourcePrefix+ , deleteResource ) where import Antiope.Core@@ -238,4 +239,13 @@ listResourcePrefix envAws location = case location of S3 s3Uri -> fmap S3 <$> runAws envAws (AWS.lsPrefix (s3Uri ^. the @"bucket") (s3Uri ^. the @"objectKey" . the @1)) Local path -> fmap Local <$> lift (FIO.listFilesRecursiveWithPrefix path)- HttpUri _ -> throwError "HTTP PUT method not supported"+ HttpUri _ -> throwError "HTTP method not supported"++deleteResource :: MonadResource m => AWS.Env -> Location -> ExceptT UriError m ()+deleteResource envAws location = case location of+ S3 s3Uri -> do+ result <- runAws envAws $ AWS.deleteFiles (s3Uri ^. the @"bucket") [s3Uri ^. the @"objectKey"]+ when (result /= [s3Uri]) $ throwError $ DeleteFailed (tshow location)+ Local path -> liftIO $ IO.removeFile path+ HttpUri _ -> throwError "HTTP method not supported"+
src/HaskellWorks/Data/Uri/UriError.hs view
@@ -24,6 +24,7 @@ } | RetriesFailedUriError | NotFound+ | DeleteFailed Text | GenericUriError Text deriving (Eq, Show, Generic)