{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.S3.DeleteObject
(
deleteObject
, DeleteObject
, doVersionId
, doMFA
, doRequestPayer
, doBucket
, doKey
, deleteObjectResponse
, DeleteObjectResponse
, dorsRequestCharged
, dorsVersionId
, dorsDeleteMarker
, dorsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
data DeleteObject = DeleteObject'
{ _doVersionId :: !(Maybe ObjectVersionId)
, _doMFA :: !(Maybe Text)
, _doRequestPayer :: !(Maybe RequestPayer)
, _doBucket :: !BucketName
, _doKey :: !ObjectKey
} deriving (Eq, Read, Show, Data, Typeable, Generic)
deleteObject
:: BucketName
-> ObjectKey
-> DeleteObject
deleteObject pBucket_ pKey_ =
DeleteObject'
{ _doVersionId = Nothing
, _doMFA = Nothing
, _doRequestPayer = Nothing
, _doBucket = pBucket_
, _doKey = pKey_
}
doVersionId :: Lens' DeleteObject (Maybe ObjectVersionId)
doVersionId = lens _doVersionId (\ s a -> s{_doVersionId = a})
doMFA :: Lens' DeleteObject (Maybe Text)
doMFA = lens _doMFA (\ s a -> s{_doMFA = a})
doRequestPayer :: Lens' DeleteObject (Maybe RequestPayer)
doRequestPayer = lens _doRequestPayer (\ s a -> s{_doRequestPayer = a})
doBucket :: Lens' DeleteObject BucketName
doBucket = lens _doBucket (\ s a -> s{_doBucket = a})
doKey :: Lens' DeleteObject ObjectKey
doKey = lens _doKey (\ s a -> s{_doKey = a})
instance AWSRequest DeleteObject where
type Rs DeleteObject = DeleteObjectResponse
request = delete s3
response
= receiveEmpty
(\ s h x ->
DeleteObjectResponse' <$>
(h .#? "x-amz-request-charged") <*>
(h .#? "x-amz-version-id")
<*> (h .#? "x-amz-delete-marker")
<*> (pure (fromEnum s)))
instance Hashable DeleteObject where
instance NFData DeleteObject where
instance ToHeaders DeleteObject where
toHeaders DeleteObject'{..}
= mconcat
["x-amz-mfa" =# _doMFA,
"x-amz-request-payer" =# _doRequestPayer]
instance ToPath DeleteObject where
toPath DeleteObject'{..}
= mconcat ["/", toBS _doBucket, "/", toBS _doKey]
instance ToQuery DeleteObject where
toQuery DeleteObject'{..}
= mconcat ["versionId" =: _doVersionId]
data DeleteObjectResponse = DeleteObjectResponse'
{ _dorsRequestCharged :: !(Maybe RequestCharged)
, _dorsVersionId :: !(Maybe ObjectVersionId)
, _dorsDeleteMarker :: !(Maybe Bool)
, _dorsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
deleteObjectResponse
:: Int
-> DeleteObjectResponse
deleteObjectResponse pResponseStatus_ =
DeleteObjectResponse'
{ _dorsRequestCharged = Nothing
, _dorsVersionId = Nothing
, _dorsDeleteMarker = Nothing
, _dorsResponseStatus = pResponseStatus_
}
dorsRequestCharged :: Lens' DeleteObjectResponse (Maybe RequestCharged)
dorsRequestCharged = lens _dorsRequestCharged (\ s a -> s{_dorsRequestCharged = a})
dorsVersionId :: Lens' DeleteObjectResponse (Maybe ObjectVersionId)
dorsVersionId = lens _dorsVersionId (\ s a -> s{_dorsVersionId = a})
dorsDeleteMarker :: Lens' DeleteObjectResponse (Maybe Bool)
dorsDeleteMarker = lens _dorsDeleteMarker (\ s a -> s{_dorsDeleteMarker = a})
dorsResponseStatus :: Lens' DeleteObjectResponse Int
dorsResponseStatus = lens _dorsResponseStatus (\ s a -> s{_dorsResponseStatus = a})
instance NFData DeleteObjectResponse where