{-# 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.CreateMultipartUpload
(
createMultipartUpload
, CreateMultipartUpload
, cmuExpires
, cmuGrantReadACP
, cmuSSECustomerAlgorithm
, cmuSSECustomerKey
, cmuRequestPayer
, cmuGrantWriteACP
, cmuWebsiteRedirectLocation
, cmuGrantRead
, cmuStorageClass
, cmuSSECustomerKeyMD5
, cmuSSEKMSKeyId
, cmuGrantFullControl
, cmuContentEncoding
, cmuTagging
, cmuMetadata
, cmuCacheControl
, cmuContentLanguage
, cmuACL
, cmuContentDisposition
, cmuServerSideEncryption
, cmuContentType
, cmuBucket
, cmuKey
, createMultipartUploadResponse
, CreateMultipartUploadResponse
, cmursRequestCharged
, cmursBucket
, cmursSSECustomerAlgorithm
, cmursAbortDate
, cmursAbortRuleId
, cmursKey
, cmursSSECustomerKeyMD5
, cmursSSEKMSKeyId
, cmursUploadId
, cmursServerSideEncryption
, cmursResponseStatus
) 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 CreateMultipartUpload = CreateMultipartUpload'
{ _cmuExpires :: !(Maybe RFC822)
, _cmuGrantReadACP :: !(Maybe Text)
, _cmuSSECustomerAlgorithm :: !(Maybe Text)
, _cmuSSECustomerKey :: !(Maybe (Sensitive Text))
, _cmuRequestPayer :: !(Maybe RequestPayer)
, _cmuGrantWriteACP :: !(Maybe Text)
, _cmuWebsiteRedirectLocation :: !(Maybe Text)
, _cmuGrantRead :: !(Maybe Text)
, _cmuStorageClass :: !(Maybe StorageClass)
, _cmuSSECustomerKeyMD5 :: !(Maybe Text)
, _cmuSSEKMSKeyId :: !(Maybe (Sensitive Text))
, _cmuGrantFullControl :: !(Maybe Text)
, _cmuContentEncoding :: !(Maybe Text)
, _cmuTagging :: !(Maybe Text)
, _cmuMetadata :: !(Map Text Text)
, _cmuCacheControl :: !(Maybe Text)
, _cmuContentLanguage :: !(Maybe Text)
, _cmuACL :: !(Maybe ObjectCannedACL)
, _cmuContentDisposition :: !(Maybe Text)
, _cmuServerSideEncryption :: !(Maybe ServerSideEncryption)
, _cmuContentType :: !(Maybe Text)
, _cmuBucket :: !BucketName
, _cmuKey :: !ObjectKey
} deriving (Eq, Show, Data, Typeable, Generic)
createMultipartUpload
:: BucketName
-> ObjectKey
-> CreateMultipartUpload
createMultipartUpload pBucket_ pKey_ =
CreateMultipartUpload'
{ _cmuExpires = Nothing
, _cmuGrantReadACP = Nothing
, _cmuSSECustomerAlgorithm = Nothing
, _cmuSSECustomerKey = Nothing
, _cmuRequestPayer = Nothing
, _cmuGrantWriteACP = Nothing
, _cmuWebsiteRedirectLocation = Nothing
, _cmuGrantRead = Nothing
, _cmuStorageClass = Nothing
, _cmuSSECustomerKeyMD5 = Nothing
, _cmuSSEKMSKeyId = Nothing
, _cmuGrantFullControl = Nothing
, _cmuContentEncoding = Nothing
, _cmuTagging = Nothing
, _cmuMetadata = mempty
, _cmuCacheControl = Nothing
, _cmuContentLanguage = Nothing
, _cmuACL = Nothing
, _cmuContentDisposition = Nothing
, _cmuServerSideEncryption = Nothing
, _cmuContentType = Nothing
, _cmuBucket = pBucket_
, _cmuKey = pKey_
}
cmuExpires :: Lens' CreateMultipartUpload (Maybe UTCTime)
cmuExpires = lens _cmuExpires (\ s a -> s{_cmuExpires = a}) . mapping _Time
cmuGrantReadACP :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantReadACP = lens _cmuGrantReadACP (\ s a -> s{_cmuGrantReadACP = a})
cmuSSECustomerAlgorithm :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSECustomerAlgorithm = lens _cmuSSECustomerAlgorithm (\ s a -> s{_cmuSSECustomerAlgorithm = a})
cmuSSECustomerKey :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSECustomerKey = lens _cmuSSECustomerKey (\ s a -> s{_cmuSSECustomerKey = a}) . mapping _Sensitive
cmuRequestPayer :: Lens' CreateMultipartUpload (Maybe RequestPayer)
cmuRequestPayer = lens _cmuRequestPayer (\ s a -> s{_cmuRequestPayer = a})
cmuGrantWriteACP :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantWriteACP = lens _cmuGrantWriteACP (\ s a -> s{_cmuGrantWriteACP = a})
cmuWebsiteRedirectLocation :: Lens' CreateMultipartUpload (Maybe Text)
cmuWebsiteRedirectLocation = lens _cmuWebsiteRedirectLocation (\ s a -> s{_cmuWebsiteRedirectLocation = a})
cmuGrantRead :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantRead = lens _cmuGrantRead (\ s a -> s{_cmuGrantRead = a})
cmuStorageClass :: Lens' CreateMultipartUpload (Maybe StorageClass)
cmuStorageClass = lens _cmuStorageClass (\ s a -> s{_cmuStorageClass = a})
cmuSSECustomerKeyMD5 :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSECustomerKeyMD5 = lens _cmuSSECustomerKeyMD5 (\ s a -> s{_cmuSSECustomerKeyMD5 = a})
cmuSSEKMSKeyId :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSEKMSKeyId = lens _cmuSSEKMSKeyId (\ s a -> s{_cmuSSEKMSKeyId = a}) . mapping _Sensitive
cmuGrantFullControl :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantFullControl = lens _cmuGrantFullControl (\ s a -> s{_cmuGrantFullControl = a})
cmuContentEncoding :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentEncoding = lens _cmuContentEncoding (\ s a -> s{_cmuContentEncoding = a})
cmuTagging :: Lens' CreateMultipartUpload (Maybe Text)
cmuTagging = lens _cmuTagging (\ s a -> s{_cmuTagging = a})
cmuMetadata :: Lens' CreateMultipartUpload (HashMap Text Text)
cmuMetadata = lens _cmuMetadata (\ s a -> s{_cmuMetadata = a}) . _Map
cmuCacheControl :: Lens' CreateMultipartUpload (Maybe Text)
cmuCacheControl = lens _cmuCacheControl (\ s a -> s{_cmuCacheControl = a})
cmuContentLanguage :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentLanguage = lens _cmuContentLanguage (\ s a -> s{_cmuContentLanguage = a})
cmuACL :: Lens' CreateMultipartUpload (Maybe ObjectCannedACL)
cmuACL = lens _cmuACL (\ s a -> s{_cmuACL = a})
cmuContentDisposition :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentDisposition = lens _cmuContentDisposition (\ s a -> s{_cmuContentDisposition = a})
cmuServerSideEncryption :: Lens' CreateMultipartUpload (Maybe ServerSideEncryption)
cmuServerSideEncryption = lens _cmuServerSideEncryption (\ s a -> s{_cmuServerSideEncryption = a})
cmuContentType :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentType = lens _cmuContentType (\ s a -> s{_cmuContentType = a})
cmuBucket :: Lens' CreateMultipartUpload BucketName
cmuBucket = lens _cmuBucket (\ s a -> s{_cmuBucket = a})
cmuKey :: Lens' CreateMultipartUpload ObjectKey
cmuKey = lens _cmuKey (\ s a -> s{_cmuKey = a})
instance AWSRequest CreateMultipartUpload where
type Rs CreateMultipartUpload =
CreateMultipartUploadResponse
request = post s3
response
= receiveXML
(\ s h x ->
CreateMultipartUploadResponse' <$>
(h .#? "x-amz-request-charged") <*> (x .@? "Bucket")
<*>
(h .#?
"x-amz-server-side-encryption-customer-algorithm")
<*> (h .#? "x-amz-abort-date")
<*> (h .#? "x-amz-abort-rule-id")
<*> (x .@? "Key")
<*>
(h .#?
"x-amz-server-side-encryption-customer-key-MD5")
<*>
(h .#? "x-amz-server-side-encryption-aws-kms-key-id")
<*> (x .@? "UploadId")
<*> (h .#? "x-amz-server-side-encryption")
<*> (pure (fromEnum s)))
instance Hashable CreateMultipartUpload where
instance NFData CreateMultipartUpload where
instance ToHeaders CreateMultipartUpload where
toHeaders CreateMultipartUpload'{..}
= mconcat
["Expires" =# _cmuExpires,
"x-amz-grant-read-acp" =# _cmuGrantReadACP,
"x-amz-server-side-encryption-customer-algorithm" =#
_cmuSSECustomerAlgorithm,
"x-amz-server-side-encryption-customer-key" =#
_cmuSSECustomerKey,
"x-amz-request-payer" =# _cmuRequestPayer,
"x-amz-grant-write-acp" =# _cmuGrantWriteACP,
"x-amz-website-redirect-location" =#
_cmuWebsiteRedirectLocation,
"x-amz-grant-read" =# _cmuGrantRead,
"x-amz-storage-class" =# _cmuStorageClass,
"x-amz-server-side-encryption-customer-key-MD5" =#
_cmuSSECustomerKeyMD5,
"x-amz-server-side-encryption-aws-kms-key-id" =#
_cmuSSEKMSKeyId,
"x-amz-grant-full-control" =# _cmuGrantFullControl,
"Content-Encoding" =# _cmuContentEncoding,
"x-amz-tagging" =# _cmuTagging,
"x-amz-meta-" =# _cmuMetadata,
"Cache-Control" =# _cmuCacheControl,
"Content-Language" =# _cmuContentLanguage,
"x-amz-acl" =# _cmuACL,
"Content-Disposition" =# _cmuContentDisposition,
"x-amz-server-side-encryption" =#
_cmuServerSideEncryption,
"Content-Type" =# _cmuContentType]
instance ToPath CreateMultipartUpload where
toPath CreateMultipartUpload'{..}
= mconcat ["/", toBS _cmuBucket, "/", toBS _cmuKey]
instance ToQuery CreateMultipartUpload where
toQuery = const (mconcat ["uploads"])
data CreateMultipartUploadResponse = CreateMultipartUploadResponse'
{ _cmursRequestCharged :: !(Maybe RequestCharged)
, _cmursBucket :: !(Maybe BucketName)
, _cmursSSECustomerAlgorithm :: !(Maybe Text)
, _cmursAbortDate :: !(Maybe RFC822)
, _cmursAbortRuleId :: !(Maybe Text)
, _cmursKey :: !(Maybe ObjectKey)
, _cmursSSECustomerKeyMD5 :: !(Maybe Text)
, _cmursSSEKMSKeyId :: !(Maybe (Sensitive Text))
, _cmursUploadId :: !(Maybe Text)
, _cmursServerSideEncryption :: !(Maybe ServerSideEncryption)
, _cmursResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
createMultipartUploadResponse
:: Int
-> CreateMultipartUploadResponse
createMultipartUploadResponse pResponseStatus_ =
CreateMultipartUploadResponse'
{ _cmursRequestCharged = Nothing
, _cmursBucket = Nothing
, _cmursSSECustomerAlgorithm = Nothing
, _cmursAbortDate = Nothing
, _cmursAbortRuleId = Nothing
, _cmursKey = Nothing
, _cmursSSECustomerKeyMD5 = Nothing
, _cmursSSEKMSKeyId = Nothing
, _cmursUploadId = Nothing
, _cmursServerSideEncryption = Nothing
, _cmursResponseStatus = pResponseStatus_
}
cmursRequestCharged :: Lens' CreateMultipartUploadResponse (Maybe RequestCharged)
cmursRequestCharged = lens _cmursRequestCharged (\ s a -> s{_cmursRequestCharged = a})
cmursBucket :: Lens' CreateMultipartUploadResponse (Maybe BucketName)
cmursBucket = lens _cmursBucket (\ s a -> s{_cmursBucket = a})
cmursSSECustomerAlgorithm :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmursSSECustomerAlgorithm = lens _cmursSSECustomerAlgorithm (\ s a -> s{_cmursSSECustomerAlgorithm = a})
cmursAbortDate :: Lens' CreateMultipartUploadResponse (Maybe UTCTime)
cmursAbortDate = lens _cmursAbortDate (\ s a -> s{_cmursAbortDate = a}) . mapping _Time
cmursAbortRuleId :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmursAbortRuleId = lens _cmursAbortRuleId (\ s a -> s{_cmursAbortRuleId = a})
cmursKey :: Lens' CreateMultipartUploadResponse (Maybe ObjectKey)
cmursKey = lens _cmursKey (\ s a -> s{_cmursKey = a})
cmursSSECustomerKeyMD5 :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmursSSECustomerKeyMD5 = lens _cmursSSECustomerKeyMD5 (\ s a -> s{_cmursSSECustomerKeyMD5 = a})
cmursSSEKMSKeyId :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmursSSEKMSKeyId = lens _cmursSSEKMSKeyId (\ s a -> s{_cmursSSEKMSKeyId = a}) . mapping _Sensitive
cmursUploadId :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmursUploadId = lens _cmursUploadId (\ s a -> s{_cmursUploadId = a})
cmursServerSideEncryption :: Lens' CreateMultipartUploadResponse (Maybe ServerSideEncryption)
cmursServerSideEncryption = lens _cmursServerSideEncryption (\ s a -> s{_cmursServerSideEncryption = a})
cmursResponseStatus :: Lens' CreateMultipartUploadResponse Int
cmursResponseStatus = lens _cmursResponseStatus (\ s a -> s{_cmursResponseStatus = a})
instance NFData CreateMultipartUploadResponse where