module Network.AWS.S3.DeleteObject
(
DeleteObject
, deleteObject
, doBucket
, doKey
, doMFA
, doVersionId
, DeleteObjectResponse
, deleteObjectResponse
, dorDeleteMarker
, dorVersionId
) where
import Network.AWS.Prelude
import Network.AWS.Request.RestXML
import Network.AWS.S3.Types
import qualified GHC.Exts
data DeleteObject = DeleteObject
{ _doBucket :: Text
, _doKey :: Text
, _doMFA :: Maybe Text
, _doVersionId :: Maybe Text
} deriving (Eq, Ord, Show)
deleteObject :: Text
-> Text
-> DeleteObject
deleteObject p1 p2 = DeleteObject
{ _doBucket = p1
, _doKey = p2
, _doMFA = Nothing
, _doVersionId = Nothing
}
doBucket :: Lens' DeleteObject Text
doBucket = lens _doBucket (\s a -> s { _doBucket = a })
doKey :: Lens' DeleteObject Text
doKey = lens _doKey (\s a -> s { _doKey = a })
doMFA :: Lens' DeleteObject (Maybe Text)
doMFA = lens _doMFA (\s a -> s { _doMFA = a })
doVersionId :: Lens' DeleteObject (Maybe Text)
doVersionId = lens _doVersionId (\s a -> s { _doVersionId = a })
data DeleteObjectResponse = DeleteObjectResponse
{ _dorDeleteMarker :: Maybe Bool
, _dorVersionId :: Maybe Text
} deriving (Eq, Ord, Show)
deleteObjectResponse :: DeleteObjectResponse
deleteObjectResponse = DeleteObjectResponse
{ _dorDeleteMarker = Nothing
, _dorVersionId = Nothing
}
dorDeleteMarker :: Lens' DeleteObjectResponse (Maybe Bool)
dorDeleteMarker = lens _dorDeleteMarker (\s a -> s { _dorDeleteMarker = a })
dorVersionId :: Lens' DeleteObjectResponse (Maybe Text)
dorVersionId = lens _dorVersionId (\s a -> s { _dorVersionId = a })
instance ToPath DeleteObject where
toPath DeleteObject{..} = mconcat
[ "/"
, toText _doBucket
, "/"
, toText _doKey
]
instance ToQuery DeleteObject where
toQuery rq = "versionId" =? _doVersionId rq
instance ToHeaders DeleteObject where
toHeaders DeleteObject{..} = mconcat
[ "x-amz-mfa" =: _doMFA
]
instance ToXMLRoot DeleteObject where
toXMLRoot = const (namespaced ns "DeleteObject" [])
instance ToXML DeleteObject
instance AWSRequest DeleteObject where
type Sv DeleteObject = S3
type Rs DeleteObject = DeleteObjectResponse
request = delete
response = headerResponse $ \h -> DeleteObjectResponse
<$> h ~:? "x-amz-delete-marker"
<*> h ~:? "x-amz-version-id"