{-# 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.AbortMultipartUpload
(
abortMultipartUpload
, AbortMultipartUpload
, amuRequestPayer
, amuBucket
, amuKey
, amuUploadId
, abortMultipartUploadResponse
, AbortMultipartUploadResponse
, amursRequestCharged
, amursResponseStatus
) 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 AbortMultipartUpload = AbortMultipartUpload'
{ _amuRequestPayer :: !(Maybe RequestPayer)
, _amuBucket :: !BucketName
, _amuKey :: !ObjectKey
, _amuUploadId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
abortMultipartUpload
:: BucketName
-> ObjectKey
-> Text
-> AbortMultipartUpload
abortMultipartUpload pBucket_ pKey_ pUploadId_ =
AbortMultipartUpload'
{ _amuRequestPayer = Nothing
, _amuBucket = pBucket_
, _amuKey = pKey_
, _amuUploadId = pUploadId_
}
amuRequestPayer :: Lens' AbortMultipartUpload (Maybe RequestPayer)
amuRequestPayer = lens _amuRequestPayer (\ s a -> s{_amuRequestPayer = a})
amuBucket :: Lens' AbortMultipartUpload BucketName
amuBucket = lens _amuBucket (\ s a -> s{_amuBucket = a})
amuKey :: Lens' AbortMultipartUpload ObjectKey
amuKey = lens _amuKey (\ s a -> s{_amuKey = a})
amuUploadId :: Lens' AbortMultipartUpload Text
amuUploadId = lens _amuUploadId (\ s a -> s{_amuUploadId = a})
instance AWSRequest AbortMultipartUpload where
type Rs AbortMultipartUpload =
AbortMultipartUploadResponse
request = delete s3
response
= receiveEmpty
(\ s h x ->
AbortMultipartUploadResponse' <$>
(h .#? "x-amz-request-charged") <*>
(pure (fromEnum s)))
instance Hashable AbortMultipartUpload where
instance NFData AbortMultipartUpload where
instance ToHeaders AbortMultipartUpload where
toHeaders AbortMultipartUpload'{..}
= mconcat ["x-amz-request-payer" =# _amuRequestPayer]
instance ToPath AbortMultipartUpload where
toPath AbortMultipartUpload'{..}
= mconcat ["/", toBS _amuBucket, "/", toBS _amuKey]
instance ToQuery AbortMultipartUpload where
toQuery AbortMultipartUpload'{..}
= mconcat ["uploadId" =: _amuUploadId]
data AbortMultipartUploadResponse = AbortMultipartUploadResponse'
{ _amursRequestCharged :: !(Maybe RequestCharged)
, _amursResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
abortMultipartUploadResponse
:: Int
-> AbortMultipartUploadResponse
abortMultipartUploadResponse pResponseStatus_ =
AbortMultipartUploadResponse'
{_amursRequestCharged = Nothing, _amursResponseStatus = pResponseStatus_}
amursRequestCharged :: Lens' AbortMultipartUploadResponse (Maybe RequestCharged)
amursRequestCharged = lens _amursRequestCharged (\ s a -> s{_amursRequestCharged = a})
amursResponseStatus :: Lens' AbortMultipartUploadResponse Int
amursResponseStatus = lens _amursResponseStatus (\ s a -> s{_amursResponseStatus = a})
instance NFData AbortMultipartUploadResponse where