{-# 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.UploadPartCopy
(
uploadPartCopy
, UploadPartCopy
, upcCopySourceIfModifiedSince
, upcCopySourceIfUnmodifiedSince
, upcCopySourceRange
, upcCopySourceSSECustomerKeyMD5
, upcCopySourceIfNoneMatch
, upcSSECustomerAlgorithm
, upcSSECustomerKey
, upcRequestPayer
, upcCopySourceIfMatch
, upcSSECustomerKeyMD5
, upcCopySourceSSECustomerKey
, upcCopySourceSSECustomerAlgorithm
, upcBucket
, upcCopySource
, upcKey
, upcPartNumber
, upcUploadId
, uploadPartCopyResponse
, UploadPartCopyResponse
, upcrsRequestCharged
, upcrsCopyPartResult
, upcrsSSECustomerAlgorithm
, upcrsCopySourceVersionId
, upcrsSSECustomerKeyMD5
, upcrsSSEKMSKeyId
, upcrsServerSideEncryption
, upcrsResponseStatus
) 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 UploadPartCopy = UploadPartCopy'
{ _upcCopySourceIfModifiedSince :: !(Maybe RFC822)
, _upcCopySourceIfUnmodifiedSince :: !(Maybe RFC822)
, _upcCopySourceRange :: !(Maybe Text)
, _upcCopySourceSSECustomerKeyMD5 :: !(Maybe Text)
, _upcCopySourceIfNoneMatch :: !(Maybe Text)
, _upcSSECustomerAlgorithm :: !(Maybe Text)
, _upcSSECustomerKey :: !(Maybe (Sensitive Text))
, _upcRequestPayer :: !(Maybe RequestPayer)
, _upcCopySourceIfMatch :: !(Maybe Text)
, _upcSSECustomerKeyMD5 :: !(Maybe Text)
, _upcCopySourceSSECustomerKey :: !(Maybe (Sensitive Text))
, _upcCopySourceSSECustomerAlgorithm :: !(Maybe Text)
, _upcBucket :: !BucketName
, _upcCopySource :: !Text
, _upcKey :: !ObjectKey
, _upcPartNumber :: !Int
, _upcUploadId :: !Text
} deriving (Eq, Show, Data, Typeable, Generic)
uploadPartCopy
:: BucketName
-> Text
-> ObjectKey
-> Int
-> Text
-> UploadPartCopy
uploadPartCopy pBucket_ pCopySource_ pKey_ pPartNumber_ pUploadId_ =
UploadPartCopy'
{ _upcCopySourceIfModifiedSince = Nothing
, _upcCopySourceIfUnmodifiedSince = Nothing
, _upcCopySourceRange = Nothing
, _upcCopySourceSSECustomerKeyMD5 = Nothing
, _upcCopySourceIfNoneMatch = Nothing
, _upcSSECustomerAlgorithm = Nothing
, _upcSSECustomerKey = Nothing
, _upcRequestPayer = Nothing
, _upcCopySourceIfMatch = Nothing
, _upcSSECustomerKeyMD5 = Nothing
, _upcCopySourceSSECustomerKey = Nothing
, _upcCopySourceSSECustomerAlgorithm = Nothing
, _upcBucket = pBucket_
, _upcCopySource = pCopySource_
, _upcKey = pKey_
, _upcPartNumber = pPartNumber_
, _upcUploadId = pUploadId_
}
upcCopySourceIfModifiedSince :: Lens' UploadPartCopy (Maybe UTCTime)
upcCopySourceIfModifiedSince = lens _upcCopySourceIfModifiedSince (\ s a -> s{_upcCopySourceIfModifiedSince = a}) . mapping _Time
upcCopySourceIfUnmodifiedSince :: Lens' UploadPartCopy (Maybe UTCTime)
upcCopySourceIfUnmodifiedSince = lens _upcCopySourceIfUnmodifiedSince (\ s a -> s{_upcCopySourceIfUnmodifiedSince = a}) . mapping _Time
upcCopySourceRange :: Lens' UploadPartCopy (Maybe Text)
upcCopySourceRange = lens _upcCopySourceRange (\ s a -> s{_upcCopySourceRange = a})
upcCopySourceSSECustomerKeyMD5 :: Lens' UploadPartCopy (Maybe Text)
upcCopySourceSSECustomerKeyMD5 = lens _upcCopySourceSSECustomerKeyMD5 (\ s a -> s{_upcCopySourceSSECustomerKeyMD5 = a})
upcCopySourceIfNoneMatch :: Lens' UploadPartCopy (Maybe Text)
upcCopySourceIfNoneMatch = lens _upcCopySourceIfNoneMatch (\ s a -> s{_upcCopySourceIfNoneMatch = a})
upcSSECustomerAlgorithm :: Lens' UploadPartCopy (Maybe Text)
upcSSECustomerAlgorithm = lens _upcSSECustomerAlgorithm (\ s a -> s{_upcSSECustomerAlgorithm = a})
upcSSECustomerKey :: Lens' UploadPartCopy (Maybe Text)
upcSSECustomerKey = lens _upcSSECustomerKey (\ s a -> s{_upcSSECustomerKey = a}) . mapping _Sensitive
upcRequestPayer :: Lens' UploadPartCopy (Maybe RequestPayer)
upcRequestPayer = lens _upcRequestPayer (\ s a -> s{_upcRequestPayer = a})
upcCopySourceIfMatch :: Lens' UploadPartCopy (Maybe Text)
upcCopySourceIfMatch = lens _upcCopySourceIfMatch (\ s a -> s{_upcCopySourceIfMatch = a})
upcSSECustomerKeyMD5 :: Lens' UploadPartCopy (Maybe Text)
upcSSECustomerKeyMD5 = lens _upcSSECustomerKeyMD5 (\ s a -> s{_upcSSECustomerKeyMD5 = a})
upcCopySourceSSECustomerKey :: Lens' UploadPartCopy (Maybe Text)
upcCopySourceSSECustomerKey = lens _upcCopySourceSSECustomerKey (\ s a -> s{_upcCopySourceSSECustomerKey = a}) . mapping _Sensitive
upcCopySourceSSECustomerAlgorithm :: Lens' UploadPartCopy (Maybe Text)
upcCopySourceSSECustomerAlgorithm = lens _upcCopySourceSSECustomerAlgorithm (\ s a -> s{_upcCopySourceSSECustomerAlgorithm = a})
upcBucket :: Lens' UploadPartCopy BucketName
upcBucket = lens _upcBucket (\ s a -> s{_upcBucket = a})
upcCopySource :: Lens' UploadPartCopy Text
upcCopySource = lens _upcCopySource (\ s a -> s{_upcCopySource = a})
upcKey :: Lens' UploadPartCopy ObjectKey
upcKey = lens _upcKey (\ s a -> s{_upcKey = a})
upcPartNumber :: Lens' UploadPartCopy Int
upcPartNumber = lens _upcPartNumber (\ s a -> s{_upcPartNumber = a})
upcUploadId :: Lens' UploadPartCopy Text
upcUploadId = lens _upcUploadId (\ s a -> s{_upcUploadId = a})
instance AWSRequest UploadPartCopy where
type Rs UploadPartCopy = UploadPartCopyResponse
request = put s3
response
= receiveXML
(\ s h x ->
UploadPartCopyResponse' <$>
(h .#? "x-amz-request-charged") <*> (parseXML x) <*>
(h .#?
"x-amz-server-side-encryption-customer-algorithm")
<*> (h .#? "x-amz-copy-source-version-id")
<*>
(h .#?
"x-amz-server-side-encryption-customer-key-MD5")
<*>
(h .#? "x-amz-server-side-encryption-aws-kms-key-id")
<*> (h .#? "x-amz-server-side-encryption")
<*> (pure (fromEnum s)))
instance Hashable UploadPartCopy where
instance NFData UploadPartCopy where
instance ToHeaders UploadPartCopy where
toHeaders UploadPartCopy'{..}
= mconcat
["x-amz-copy-source-if-modified-since" =#
_upcCopySourceIfModifiedSince,
"x-amz-copy-source-if-unmodified-since" =#
_upcCopySourceIfUnmodifiedSince,
"x-amz-copy-source-range" =# _upcCopySourceRange,
"x-amz-copy-source-server-side-encryption-customer-key-MD5"
=# _upcCopySourceSSECustomerKeyMD5,
"x-amz-copy-source-if-none-match" =#
_upcCopySourceIfNoneMatch,
"x-amz-server-side-encryption-customer-algorithm" =#
_upcSSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key" =#
_upcSSECustomerKey,
"x-amz-request-payer" =# _upcRequestPayer,
"x-amz-copy-source-if-match" =#
_upcCopySourceIfMatch,
"x-amz-server-side-encryption-customer-key-MD5" =#
_upcSSECustomerKeyMD5,
"x-amz-copy-source-server-side-encryption-customer-key"
=# _upcCopySourceSSECustomerKey,
"x-amz-copy-source-server-side-encryption-customer-algorithm"
=# _upcCopySourceSSECustomerAlgorithm,
"x-amz-copy-source" =# _upcCopySource]
instance ToPath UploadPartCopy where
toPath UploadPartCopy'{..}
= mconcat ["/", toBS _upcBucket, "/", toBS _upcKey]
instance ToQuery UploadPartCopy where
toQuery UploadPartCopy'{..}
= mconcat
["partNumber" =: _upcPartNumber,
"uploadId" =: _upcUploadId]
data UploadPartCopyResponse = UploadPartCopyResponse'
{ _upcrsRequestCharged :: !(Maybe RequestCharged)
, _upcrsCopyPartResult :: !(Maybe CopyPartResult)
, _upcrsSSECustomerAlgorithm :: !(Maybe Text)
, _upcrsCopySourceVersionId :: !(Maybe Text)
, _upcrsSSECustomerKeyMD5 :: !(Maybe Text)
, _upcrsSSEKMSKeyId :: !(Maybe (Sensitive Text))
, _upcrsServerSideEncryption :: !(Maybe ServerSideEncryption)
, _upcrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
uploadPartCopyResponse
:: Int
-> UploadPartCopyResponse
uploadPartCopyResponse pResponseStatus_ =
UploadPartCopyResponse'
{ _upcrsRequestCharged = Nothing
, _upcrsCopyPartResult = Nothing
, _upcrsSSECustomerAlgorithm = Nothing
, _upcrsCopySourceVersionId = Nothing
, _upcrsSSECustomerKeyMD5 = Nothing
, _upcrsSSEKMSKeyId = Nothing
, _upcrsServerSideEncryption = Nothing
, _upcrsResponseStatus = pResponseStatus_
}
upcrsRequestCharged :: Lens' UploadPartCopyResponse (Maybe RequestCharged)
upcrsRequestCharged = lens _upcrsRequestCharged (\ s a -> s{_upcrsRequestCharged = a})
upcrsCopyPartResult :: Lens' UploadPartCopyResponse (Maybe CopyPartResult)
upcrsCopyPartResult = lens _upcrsCopyPartResult (\ s a -> s{_upcrsCopyPartResult = a})
upcrsSSECustomerAlgorithm :: Lens' UploadPartCopyResponse (Maybe Text)
upcrsSSECustomerAlgorithm = lens _upcrsSSECustomerAlgorithm (\ s a -> s{_upcrsSSECustomerAlgorithm = a})
upcrsCopySourceVersionId :: Lens' UploadPartCopyResponse (Maybe Text)
upcrsCopySourceVersionId = lens _upcrsCopySourceVersionId (\ s a -> s{_upcrsCopySourceVersionId = a})
upcrsSSECustomerKeyMD5 :: Lens' UploadPartCopyResponse (Maybe Text)
upcrsSSECustomerKeyMD5 = lens _upcrsSSECustomerKeyMD5 (\ s a -> s{_upcrsSSECustomerKeyMD5 = a})
upcrsSSEKMSKeyId :: Lens' UploadPartCopyResponse (Maybe Text)
upcrsSSEKMSKeyId = lens _upcrsSSEKMSKeyId (\ s a -> s{_upcrsSSEKMSKeyId = a}) . mapping _Sensitive
upcrsServerSideEncryption :: Lens' UploadPartCopyResponse (Maybe ServerSideEncryption)
upcrsServerSideEncryption = lens _upcrsServerSideEncryption (\ s a -> s{_upcrsServerSideEncryption = a})
upcrsResponseStatus :: Lens' UploadPartCopyResponse Int
upcrsResponseStatus = lens _upcrsResponseStatus (\ s a -> s{_upcrsResponseStatus = a})
instance NFData UploadPartCopyResponse where