module Network.AWS.S3.CreateMultipartUpload
    (
    
      CreateMultipartUpload
    
    , createMultipartUpload
    
    , cmuACL
    , cmuBucket
    , cmuCacheControl
    , cmuContentDisposition
    , cmuContentEncoding
    , cmuContentLanguage
    , cmuContentType
    , cmuExpires
    , cmuGrantFullControl
    , cmuGrantRead
    , cmuGrantReadACP
    , cmuGrantWriteACP
    , cmuKey
    , cmuMetadata
    , cmuSSECustomerAlgorithm
    , cmuSSECustomerKey
    , cmuSSECustomerKeyMD5
    , cmuSSEKMSKeyId
    , cmuServerSideEncryption
    , cmuStorageClass
    , cmuWebsiteRedirectLocation
    
    , CreateMultipartUploadResponse
    
    , createMultipartUploadResponse
    
    , cmurBucket
    , cmurKey
    , cmurSSECustomerAlgorithm
    , cmurSSECustomerKeyMD5
    , cmurSSEKMSKeyId
    , cmurServerSideEncryption
    , cmurUploadId
    ) where
import Network.AWS.Prelude
import Network.AWS.Request.S3
import Network.AWS.S3.Types
import qualified GHC.Exts
data CreateMultipartUpload = CreateMultipartUpload
    { _cmuACL                     :: Maybe ObjectCannedACL
    , _cmuBucket                  :: Text
    , _cmuCacheControl            :: Maybe Text
    , _cmuContentDisposition      :: Maybe Text
    , _cmuContentEncoding         :: Maybe Text
    , _cmuContentLanguage         :: Maybe Text
    , _cmuContentType             :: Maybe Text
    , _cmuExpires                 :: Maybe RFC822
    , _cmuGrantFullControl        :: Maybe Text
    , _cmuGrantRead               :: Maybe Text
    , _cmuGrantReadACP            :: Maybe Text
    , _cmuGrantWriteACP           :: Maybe Text
    , _cmuKey                     :: Text
    , _cmuMetadata                :: Map (CI Text) Text
    , _cmuSSECustomerAlgorithm    :: Maybe Text
    , _cmuSSECustomerKey          :: Maybe (Sensitive Text)
    , _cmuSSECustomerKeyMD5       :: Maybe Text
    , _cmuSSEKMSKeyId             :: Maybe (Sensitive Text)
    , _cmuServerSideEncryption    :: Maybe ServerSideEncryption
    , _cmuStorageClass            :: Maybe StorageClass
    , _cmuWebsiteRedirectLocation :: Maybe Text
    } deriving (Eq, Show)
createMultipartUpload :: Text 
                      -> Text 
                      -> CreateMultipartUpload
createMultipartUpload p1 p2 = CreateMultipartUpload
    { _cmuBucket                  = p1
    , _cmuKey                     = p2
    , _cmuACL                     = Nothing
    , _cmuCacheControl            = Nothing
    , _cmuContentDisposition      = Nothing
    , _cmuContentEncoding         = Nothing
    , _cmuContentLanguage         = Nothing
    , _cmuContentType             = Nothing
    , _cmuExpires                 = Nothing
    , _cmuGrantFullControl        = Nothing
    , _cmuGrantRead               = Nothing
    , _cmuGrantReadACP            = Nothing
    , _cmuGrantWriteACP           = Nothing
    , _cmuMetadata                = mempty
    , _cmuServerSideEncryption    = Nothing
    , _cmuStorageClass            = Nothing
    , _cmuWebsiteRedirectLocation = Nothing
    , _cmuSSECustomerAlgorithm    = Nothing
    , _cmuSSECustomerKey          = Nothing
    , _cmuSSECustomerKeyMD5       = Nothing
    , _cmuSSEKMSKeyId             = Nothing
    }
cmuACL :: Lens' CreateMultipartUpload (Maybe ObjectCannedACL)
cmuACL = lens _cmuACL (\s a -> s { _cmuACL = a })
cmuBucket :: Lens' CreateMultipartUpload Text
cmuBucket = lens _cmuBucket (\s a -> s { _cmuBucket = a })
cmuCacheControl :: Lens' CreateMultipartUpload (Maybe Text)
cmuCacheControl = lens _cmuCacheControl (\s a -> s { _cmuCacheControl = a })
cmuContentDisposition :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentDisposition =
    lens _cmuContentDisposition (\s a -> s { _cmuContentDisposition = a })
cmuContentEncoding :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentEncoding =
    lens _cmuContentEncoding (\s a -> s { _cmuContentEncoding = a })
cmuContentLanguage :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentLanguage =
    lens _cmuContentLanguage (\s a -> s { _cmuContentLanguage = a })
cmuContentType :: Lens' CreateMultipartUpload (Maybe Text)
cmuContentType = lens _cmuContentType (\s a -> s { _cmuContentType = a })
cmuExpires :: Lens' CreateMultipartUpload (Maybe UTCTime)
cmuExpires = lens _cmuExpires (\s a -> s { _cmuExpires = a }) . mapping _Time
cmuGrantFullControl :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantFullControl =
    lens _cmuGrantFullControl (\s a -> s { _cmuGrantFullControl = a })
cmuGrantRead :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantRead = lens _cmuGrantRead (\s a -> s { _cmuGrantRead = a })
cmuGrantReadACP :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantReadACP = lens _cmuGrantReadACP (\s a -> s { _cmuGrantReadACP = a })
cmuGrantWriteACP :: Lens' CreateMultipartUpload (Maybe Text)
cmuGrantWriteACP = lens _cmuGrantWriteACP (\s a -> s { _cmuGrantWriteACP = a })
cmuKey :: Lens' CreateMultipartUpload Text
cmuKey = lens _cmuKey (\s a -> s { _cmuKey = a })
cmuMetadata :: Lens' CreateMultipartUpload (HashMap (CI Text) Text)
cmuMetadata = lens _cmuMetadata (\s a -> s { _cmuMetadata = a }) . _Map
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
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
cmuServerSideEncryption :: Lens' CreateMultipartUpload (Maybe ServerSideEncryption)
cmuServerSideEncryption =
    lens _cmuServerSideEncryption (\s a -> s { _cmuServerSideEncryption = a })
cmuStorageClass :: Lens' CreateMultipartUpload (Maybe StorageClass)
cmuStorageClass = lens _cmuStorageClass (\s a -> s { _cmuStorageClass = a })
cmuWebsiteRedirectLocation :: Lens' CreateMultipartUpload (Maybe Text)
cmuWebsiteRedirectLocation =
    lens _cmuWebsiteRedirectLocation
        (\s a -> s { _cmuWebsiteRedirectLocation = a })
data CreateMultipartUploadResponse = CreateMultipartUploadResponse
    { _cmurBucket               :: Maybe Text
    , _cmurKey                  :: Maybe Text
    , _cmurSSECustomerAlgorithm :: Maybe Text
    , _cmurSSECustomerKeyMD5    :: Maybe Text
    , _cmurSSEKMSKeyId          :: Maybe (Sensitive Text)
    , _cmurServerSideEncryption :: Maybe ServerSideEncryption
    , _cmurUploadId             :: Maybe Text
    } deriving (Eq, Show)
createMultipartUploadResponse :: CreateMultipartUploadResponse
createMultipartUploadResponse = CreateMultipartUploadResponse
    { _cmurBucket               = Nothing
    , _cmurKey                  = Nothing
    , _cmurUploadId             = Nothing
    , _cmurServerSideEncryption = Nothing
    , _cmurSSECustomerAlgorithm = Nothing
    , _cmurSSECustomerKeyMD5    = Nothing
    , _cmurSSEKMSKeyId          = Nothing
    }
cmurBucket :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmurBucket = lens _cmurBucket (\s a -> s { _cmurBucket = a })
cmurKey :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmurKey = lens _cmurKey (\s a -> s { _cmurKey = a })
cmurSSECustomerAlgorithm :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmurSSECustomerAlgorithm =
    lens _cmurSSECustomerAlgorithm
        (\s a -> s { _cmurSSECustomerAlgorithm = a })
cmurSSECustomerKeyMD5 :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmurSSECustomerKeyMD5 =
    lens _cmurSSECustomerKeyMD5 (\s a -> s { _cmurSSECustomerKeyMD5 = a })
cmurSSEKMSKeyId :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmurSSEKMSKeyId = lens _cmurSSEKMSKeyId (\s a -> s { _cmurSSEKMSKeyId = a }) . mapping _Sensitive
cmurServerSideEncryption :: Lens' CreateMultipartUploadResponse (Maybe ServerSideEncryption)
cmurServerSideEncryption =
    lens _cmurServerSideEncryption
        (\s a -> s { _cmurServerSideEncryption = a })
cmurUploadId :: Lens' CreateMultipartUploadResponse (Maybe Text)
cmurUploadId = lens _cmurUploadId (\s a -> s { _cmurUploadId = a })
instance ToPath CreateMultipartUpload where
    toPath CreateMultipartUpload{..} = mconcat
        [ "/"
        , toText _cmuBucket
        , "/"
        , toText _cmuKey
        ]
instance ToQuery CreateMultipartUpload where
    toQuery = const "uploads"
instance ToHeaders CreateMultipartUpload where
    toHeaders CreateMultipartUpload{..} = mconcat
        [ "x-amz-acl"                                       =: _cmuACL
        , "Cache-Control"                                   =: _cmuCacheControl
        , "Content-Disposition"                             =: _cmuContentDisposition
        , "Content-Encoding"                                =: _cmuContentEncoding
        , "Content-Language"                                =: _cmuContentLanguage
        , "Content-Type"                                    =: _cmuContentType
        , "Expires"                                         =: _cmuExpires
        , "x-amz-grant-full-control"                        =: _cmuGrantFullControl
        , "x-amz-grant-read"                                =: _cmuGrantRead
        , "x-amz-grant-read-acp"                            =: _cmuGrantReadACP
        , "x-amz-grant-write-acp"                           =: _cmuGrantWriteACP
        , "x-amz-meta-"                                     =: _cmuMetadata
        , "x-amz-server-side-encryption"                    =: _cmuServerSideEncryption
        , "x-amz-storage-class"                             =: _cmuStorageClass
        , "x-amz-website-redirect-location"                 =: _cmuWebsiteRedirectLocation
        , "x-amz-server-side-encryption-customer-algorithm" =: _cmuSSECustomerAlgorithm
        , "x-amz-server-side-encryption-customer-key"       =: _cmuSSECustomerKey
        , "x-amz-server-side-encryption-customer-key-MD5"   =: _cmuSSECustomerKeyMD5
        , "x-amz-server-side-encryption-aws-kms-key-id"     =: _cmuSSEKMSKeyId
        ]
instance ToXMLRoot CreateMultipartUpload where
    toXMLRoot = const (namespaced ns "CreateMultipartUpload" [])
instance ToXML CreateMultipartUpload
instance AWSRequest CreateMultipartUpload where
    type Sv CreateMultipartUpload = S3
    type Rs CreateMultipartUpload = CreateMultipartUploadResponse
    request  = post
    response = xmlHeaderResponse $ \h x -> CreateMultipartUploadResponse
        <$> x .@? "Bucket"
        <*> x .@? "Key"
        <*> h ~:? "x-amz-server-side-encryption-customer-algorithm"
        <*> 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"
        <*> x .@? "UploadId"