module Aws.S3.Commands.DeleteObject
where

import           Aws.Core
import           Aws.S3.Core
import           Data.ByteString.Char8      ({- IsString -})
import qualified Data.Text                  as T
import qualified Data.Text.Encoding         as T

data DeleteObject = DeleteObject {
  DeleteObject -> Text
doObjectName :: T.Text,
  DeleteObject -> Text
doBucket :: Bucket
} deriving (Int -> DeleteObject -> ShowS
[DeleteObject] -> ShowS
DeleteObject -> String
(Int -> DeleteObject -> ShowS)
-> (DeleteObject -> String)
-> ([DeleteObject] -> ShowS)
-> Show DeleteObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteObject] -> ShowS
$cshowList :: [DeleteObject] -> ShowS
show :: DeleteObject -> String
$cshow :: DeleteObject -> String
showsPrec :: Int -> DeleteObject -> ShowS
$cshowsPrec :: Int -> DeleteObject -> ShowS
Show)

data DeleteObjectResponse = DeleteObjectResponse{
} deriving (Int -> DeleteObjectResponse -> ShowS
[DeleteObjectResponse] -> ShowS
DeleteObjectResponse -> String
(Int -> DeleteObjectResponse -> ShowS)
-> (DeleteObjectResponse -> String)
-> ([DeleteObjectResponse] -> ShowS)
-> Show DeleteObjectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteObjectResponse] -> ShowS
$cshowList :: [DeleteObjectResponse] -> ShowS
show :: DeleteObjectResponse -> String
$cshow :: DeleteObjectResponse -> String
showsPrec :: Int -> DeleteObjectResponse -> ShowS
$cshowsPrec :: Int -> DeleteObjectResponse -> ShowS
Show)

-- | ServiceConfiguration: 'S3Configuration'
instance SignQuery DeleteObject where
    type ServiceConfiguration DeleteObject = S3Configuration
    signQuery :: DeleteObject
-> ServiceConfiguration DeleteObject queryType
-> SignatureData
-> SignedQuery
signQuery DeleteObject {Text
doBucket :: Text
doObjectName :: Text
doBucket :: DeleteObject -> Text
doObjectName :: DeleteObject -> Text
..} = S3Query
-> S3Configuration queryType -> SignatureData -> SignedQuery
forall qt.
S3Query -> S3Configuration qt -> SignatureData -> SignedQuery
s3SignQuery S3Query :: Method
-> Maybe ByteString
-> Maybe ByteString
-> Query
-> Query
-> Maybe ByteString
-> Maybe (Digest MD5)
-> RequestHeaders
-> RequestHeaders
-> Maybe RequestBody
-> S3Query
S3Query {
                                 s3QMethod :: Method
s3QMethod = Method
Delete
                               , s3QBucket :: Maybe ByteString
s3QBucket = ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
T.encodeUtf8 Text
doBucket
                               , s3QSubresources :: Query
s3QSubresources = []
                               , s3QQuery :: Query
s3QQuery = []
                               , s3QContentType :: Maybe ByteString
s3QContentType = Maybe ByteString
forall a. Maybe a
Nothing
                               , s3QContentMd5 :: Maybe (Digest MD5)
s3QContentMd5 = Maybe (Digest MD5)
forall a. Maybe a
Nothing
                               , s3QAmzHeaders :: RequestHeaders
s3QAmzHeaders = []
                               , s3QOtherHeaders :: RequestHeaders
s3QOtherHeaders = []
                               , s3QRequestBody :: Maybe RequestBody
s3QRequestBody = Maybe RequestBody
forall a. Maybe a
Nothing
                               , s3QObject :: Maybe ByteString
s3QObject = ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
T.encodeUtf8 Text
doObjectName
                               }

instance ResponseConsumer DeleteObject DeleteObjectResponse where
    type ResponseMetadata DeleteObjectResponse = S3Metadata
    responseConsumer :: Request
-> DeleteObject
-> IORef (ResponseMetadata DeleteObjectResponse)
-> HTTPResponseConsumer DeleteObjectResponse
responseConsumer Request
_ DeleteObject
_
        = HTTPResponseConsumer DeleteObjectResponse
-> IORef S3Metadata -> HTTPResponseConsumer DeleteObjectResponse
forall a.
HTTPResponseConsumer a
-> IORef S3Metadata -> HTTPResponseConsumer a
s3ResponseConsumer (HTTPResponseConsumer DeleteObjectResponse
 -> IORef S3Metadata -> HTTPResponseConsumer DeleteObjectResponse)
-> HTTPResponseConsumer DeleteObjectResponse
-> IORef S3Metadata
-> HTTPResponseConsumer DeleteObjectResponse
forall a b. (a -> b) -> a -> b
$ \Response (ConduitM () ByteString (ResourceT IO) ())
_ -> DeleteObjectResponse -> ResourceT IO DeleteObjectResponse
forall (m :: * -> *) a. Monad m => a -> m a
return DeleteObjectResponse
DeleteObjectResponse

instance Transaction DeleteObject DeleteObjectResponse

instance AsMemoryResponse DeleteObjectResponse where
    type MemoryResponse DeleteObjectResponse = DeleteObjectResponse
    loadToMemory :: DeleteObjectResponse
-> ResourceT IO (MemoryResponse DeleteObjectResponse)
loadToMemory = DeleteObjectResponse
-> ResourceT IO (MemoryResponse DeleteObjectResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return