module Network.AWS.S3.RestoreObject
(
restoreObject
, RestoreObject
, roVersionId
, roRequestPayer
, roRestoreRequest
, roBucket
, roKey
, restoreObjectResponse
, RestoreObjectResponse
, rorsRequestCharged
, rorsStatus
) where
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
data RestoreObject = RestoreObject'
{ _roVersionId :: !(Maybe ObjectVersionId)
, _roRequestPayer :: !(Maybe RequestPayer)
, _roRestoreRequest :: !(Maybe RestoreRequest)
, _roBucket :: !BucketName
, _roKey :: !ObjectKey
} deriving (Eq,Read,Show,Data,Typeable,Generic)
restoreObject
:: BucketName
-> ObjectKey
-> RestoreObject
restoreObject pBucket_ pKey_ =
RestoreObject'
{ _roVersionId = Nothing
, _roRequestPayer = Nothing
, _roRestoreRequest = Nothing
, _roBucket = pBucket_
, _roKey = pKey_
}
roVersionId :: Lens' RestoreObject (Maybe ObjectVersionId)
roVersionId = lens _roVersionId (\ s a -> s{_roVersionId = a});
roRequestPayer :: Lens' RestoreObject (Maybe RequestPayer)
roRequestPayer = lens _roRequestPayer (\ s a -> s{_roRequestPayer = a});
roRestoreRequest :: Lens' RestoreObject (Maybe RestoreRequest)
roRestoreRequest = lens _roRestoreRequest (\ s a -> s{_roRestoreRequest = a});
roBucket :: Lens' RestoreObject BucketName
roBucket = lens _roBucket (\ s a -> s{_roBucket = a});
roKey :: Lens' RestoreObject ObjectKey
roKey = lens _roKey (\ s a -> s{_roKey = a});
instance AWSRequest RestoreObject where
type Sv RestoreObject = S3
type Rs RestoreObject = RestoreObjectResponse
request = postXML
response
= receiveEmpty
(\ s h x ->
RestoreObjectResponse' <$>
(h .#? "x-amz-request-charged") <*>
(pure (fromEnum s)))
instance ToElement RestoreObject where
toElement
= mkElement
"{http://s3.amazonaws.com/doc/2006-03-01/}RestoreRequest"
.
_roRestoreRequest
instance ToHeaders RestoreObject where
toHeaders RestoreObject'{..}
= mconcat ["x-amz-request-payer" =# _roRequestPayer]
instance ToPath RestoreObject where
toPath RestoreObject'{..}
= mconcat ["/", toBS _roBucket, "/", toBS _roKey]
instance ToQuery RestoreObject where
toQuery RestoreObject'{..}
= mconcat ["versionId" =: _roVersionId, "restore"]
data RestoreObjectResponse = RestoreObjectResponse'
{ _rorsRequestCharged :: !(Maybe RequestCharged)
, _rorsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
restoreObjectResponse
:: Int
-> RestoreObjectResponse
restoreObjectResponse pStatus_ =
RestoreObjectResponse'
{ _rorsRequestCharged = Nothing
, _rorsStatus = pStatus_
}
rorsRequestCharged :: Lens' RestoreObjectResponse (Maybe RequestCharged)
rorsRequestCharged = lens _rorsRequestCharged (\ s a -> s{_rorsRequestCharged = a});
rorsStatus :: Lens' RestoreObjectResponse Int
rorsStatus = lens _rorsStatus (\ s a -> s{_rorsStatus = a});