module Network.AWS.S3.CompleteMultipartUpload
(
completeMultipartUpload
, CompleteMultipartUpload
, cRequestPayer
, cMultipartUpload
, cBucket
, cKey
, cUploadId
, completeMultipartUploadResponse
, CompleteMultipartUploadResponse
, crsRequestCharged
, crsETag
, crsVersionId
, crsLocation
, crsExpiration
, crsBucket
, crsKey
, crsSSEKMSKeyId
, crsServerSideEncryption
, crsResponseStatus
) 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 CompleteMultipartUpload = CompleteMultipartUpload'
{ _cRequestPayer :: !(Maybe RequestPayer)
, _cMultipartUpload :: !(Maybe CompletedMultipartUpload)
, _cBucket :: !BucketName
, _cKey :: !ObjectKey
, _cUploadId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
completeMultipartUpload
:: BucketName
-> ObjectKey
-> Text
-> CompleteMultipartUpload
completeMultipartUpload pBucket_ pKey_ pUploadId_ =
CompleteMultipartUpload'
{ _cRequestPayer = Nothing
, _cMultipartUpload = Nothing
, _cBucket = pBucket_
, _cKey = pKey_
, _cUploadId = pUploadId_
}
cRequestPayer :: Lens' CompleteMultipartUpload (Maybe RequestPayer)
cRequestPayer = lens _cRequestPayer (\ s a -> s{_cRequestPayer = a});
cMultipartUpload :: Lens' CompleteMultipartUpload (Maybe CompletedMultipartUpload)
cMultipartUpload = lens _cMultipartUpload (\ s a -> s{_cMultipartUpload = a});
cBucket :: Lens' CompleteMultipartUpload BucketName
cBucket = lens _cBucket (\ s a -> s{_cBucket = a});
cKey :: Lens' CompleteMultipartUpload ObjectKey
cKey = lens _cKey (\ s a -> s{_cKey = a});
cUploadId :: Lens' CompleteMultipartUpload Text
cUploadId = lens _cUploadId (\ s a -> s{_cUploadId = a});
instance AWSRequest CompleteMultipartUpload where
type Rs CompleteMultipartUpload =
CompleteMultipartUploadResponse
request = postXML s3
response
= receiveXML
(\ s h x ->
CompleteMultipartUploadResponse' <$>
(h .#? "x-amz-request-charged") <*> (x .@? "ETag")
<*> (h .#? "x-amz-version-id")
<*> (x .@? "Location")
<*> (h .#? "x-amz-expiration")
<*> (x .@? "Bucket")
<*> (x .@? "Key")
<*>
(h .#? "x-amz-server-side-encryption-aws-kms-key-id")
<*> (h .#? "x-amz-server-side-encryption")
<*> (pure (fromEnum s)))
instance Hashable CompleteMultipartUpload where
instance NFData CompleteMultipartUpload where
instance ToElement CompleteMultipartUpload where
toElement
= mkElement
"{http://s3.amazonaws.com/doc/2006-03-01/}CompleteMultipartUpload"
.
_cMultipartUpload
instance ToHeaders CompleteMultipartUpload where
toHeaders CompleteMultipartUpload'{..}
= mconcat ["x-amz-request-payer" =# _cRequestPayer]
instance ToPath CompleteMultipartUpload where
toPath CompleteMultipartUpload'{..}
= mconcat ["/", toBS _cBucket, "/", toBS _cKey]
instance ToQuery CompleteMultipartUpload where
toQuery CompleteMultipartUpload'{..}
= mconcat ["uploadId" =: _cUploadId]
data CompleteMultipartUploadResponse = CompleteMultipartUploadResponse'
{ _crsRequestCharged :: !(Maybe RequestCharged)
, _crsETag :: !(Maybe ETag)
, _crsVersionId :: !(Maybe ObjectVersionId)
, _crsLocation :: !(Maybe Text)
, _crsExpiration :: !(Maybe Text)
, _crsBucket :: !(Maybe BucketName)
, _crsKey :: !(Maybe ObjectKey)
, _crsSSEKMSKeyId :: !(Maybe (Sensitive Text))
, _crsServerSideEncryption :: !(Maybe ServerSideEncryption)
, _crsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
completeMultipartUploadResponse
:: Int
-> CompleteMultipartUploadResponse
completeMultipartUploadResponse pResponseStatus_ =
CompleteMultipartUploadResponse'
{ _crsRequestCharged = Nothing
, _crsETag = Nothing
, _crsVersionId = Nothing
, _crsLocation = Nothing
, _crsExpiration = Nothing
, _crsBucket = Nothing
, _crsKey = Nothing
, _crsSSEKMSKeyId = Nothing
, _crsServerSideEncryption = Nothing
, _crsResponseStatus = pResponseStatus_
}
crsRequestCharged :: Lens' CompleteMultipartUploadResponse (Maybe RequestCharged)
crsRequestCharged = lens _crsRequestCharged (\ s a -> s{_crsRequestCharged = a});
crsETag :: Lens' CompleteMultipartUploadResponse (Maybe ETag)
crsETag = lens _crsETag (\ s a -> s{_crsETag = a});
crsVersionId :: Lens' CompleteMultipartUploadResponse (Maybe ObjectVersionId)
crsVersionId = lens _crsVersionId (\ s a -> s{_crsVersionId = a});
crsLocation :: Lens' CompleteMultipartUploadResponse (Maybe Text)
crsLocation = lens _crsLocation (\ s a -> s{_crsLocation = a});
crsExpiration :: Lens' CompleteMultipartUploadResponse (Maybe Text)
crsExpiration = lens _crsExpiration (\ s a -> s{_crsExpiration = a});
crsBucket :: Lens' CompleteMultipartUploadResponse (Maybe BucketName)
crsBucket = lens _crsBucket (\ s a -> s{_crsBucket = a});
crsKey :: Lens' CompleteMultipartUploadResponse (Maybe ObjectKey)
crsKey = lens _crsKey (\ s a -> s{_crsKey = a});
crsSSEKMSKeyId :: Lens' CompleteMultipartUploadResponse (Maybe Text)
crsSSEKMSKeyId = lens _crsSSEKMSKeyId (\ s a -> s{_crsSSEKMSKeyId = a}) . mapping _Sensitive;
crsServerSideEncryption :: Lens' CompleteMultipartUploadResponse (Maybe ServerSideEncryption)
crsServerSideEncryption = lens _crsServerSideEncryption (\ s a -> s{_crsServerSideEncryption = a});
crsResponseStatus :: Lens' CompleteMultipartUploadResponse Int
crsResponseStatus = lens _crsResponseStatus (\ s a -> s{_crsResponseStatus = a});
instance NFData CompleteMultipartUploadResponse where