Skip to content

Instantly share code, notes, and snippets.

@krisis
Created March 3, 2017 11:16
Show Gist options
  • Save krisis/ef77bbd6ab9dc3039608375b6e84d8e7 to your computer and use it in GitHub Desktop.
Save krisis/ef77bbd6ab9dc3039608375b6e84d8e7 to your computer and use it in GitHub Desktop.
copy-object-part
#!/usr/bin/env stack
-- stack --resolver lts-6.27 runghc --package minio-hs
--
-- Minio Haskell SDK, (C) 2017 Minio, Inc.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
{-# Language OverloadedStrings #-}
import Control.Monad (forM_)
import Control.Monad.IO.Class (liftIO)
import Data.List.Index
import Data.Text (Text)
import qualified Data.Text.Format as TF
import Data.Text.Format.Params (Params)
import qualified Data.Text.Lazy as LT
import Network.Minio
import Network.Minio.S3API
import Prelude
format :: Params ps => TF.Format -> ps -> Data.Text.Text
format f args = LT.toStrict $ TF.format f args
main :: IO ()
main = do
let
bucket = "test"
object = "src-copy"
srcObject = "src"
res <- runResourceT $ runMinio def $ do
uploadId <- newMultipartUpload bucket object []
liftIO $ putStrLn $
"Created a multipart upload with uploadId: " ++ show uploadId
copyObjectPart bucket object def { cpSource = srcObject } uploadId 1 []
print res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment