module Network.AWS.S3.PutObject
(
PutObject
, putObject
, poACL
, poBody
, poBucket
, poCacheControl
, poContentDisposition
, poContentEncoding
, poContentLanguage
, poContentLength
, poContentMD5
, poContentType
, poExpires
, poGrantFullControl
, poGrantRead
, poGrantReadACP
, poGrantWriteACP
, poKey
, poMetadata
, poSSECustomerAlgorithm
, poSSECustomerKey
, poSSECustomerKeyMD5
, poSSEKMSKeyId
, poServerSideEncryption
, poStorageClass
, poWebsiteRedirectLocation
, PutObjectResponse
, putObjectResponse
, porETag
, porExpiration
, porSSECustomerAlgorithm
, porSSECustomerKeyMD5
, porSSEKMSKeyId
, porServerSideEncryption
, porVersionId
) where
import Network.AWS.Prelude
import Network.AWS.Request.S3
import Network.AWS.S3.Types
import qualified GHC.Exts
data PutObject = PutObject
{ _poACL :: Maybe ObjectCannedACL
, _poBody :: RqBody
, _poBucket :: Text
, _poCacheControl :: Maybe Text
, _poContentDisposition :: Maybe Text
, _poContentEncoding :: Maybe Text
, _poContentLanguage :: Maybe Text
, _poContentLength :: Maybe Int
, _poContentMD5 :: Maybe Text
, _poContentType :: Maybe Text
, _poExpires :: Maybe RFC822
, _poGrantFullControl :: Maybe Text
, _poGrantRead :: Maybe Text
, _poGrantReadACP :: Maybe Text
, _poGrantWriteACP :: Maybe Text
, _poKey :: Text
, _poMetadata :: Map (CI Text) Text
, _poSSECustomerAlgorithm :: Maybe Text
, _poSSECustomerKey :: Maybe (Sensitive Text)
, _poSSECustomerKeyMD5 :: Maybe Text
, _poSSEKMSKeyId :: Maybe (Sensitive Text)
, _poServerSideEncryption :: Maybe ServerSideEncryption
, _poStorageClass :: Maybe StorageClass
, _poWebsiteRedirectLocation :: Maybe Text
} deriving (Show)
putObject :: RqBody
-> Text
-> Text
-> PutObject
putObject p1 p2 p3 = PutObject
{ _poBody = p1
, _poBucket = p2
, _poKey = p3
, _poACL = Nothing
, _poCacheControl = Nothing
, _poContentDisposition = Nothing
, _poContentEncoding = Nothing
, _poContentLanguage = Nothing
, _poContentLength = Nothing
, _poContentMD5 = Nothing
, _poContentType = Nothing
, _poExpires = Nothing
, _poGrantFullControl = Nothing
, _poGrantRead = Nothing
, _poGrantReadACP = Nothing
, _poGrantWriteACP = Nothing
, _poMetadata = mempty
, _poServerSideEncryption = Nothing
, _poStorageClass = Nothing
, _poWebsiteRedirectLocation = Nothing
, _poSSECustomerAlgorithm = Nothing
, _poSSECustomerKey = Nothing
, _poSSECustomerKeyMD5 = Nothing
, _poSSEKMSKeyId = Nothing
}
poACL :: Lens' PutObject (Maybe ObjectCannedACL)
poACL = lens _poACL (\s a -> s { _poACL = a })
poBody :: Lens' PutObject RqBody
poBody = lens _poBody (\s a -> s { _poBody = a })
poBucket :: Lens' PutObject Text
poBucket = lens _poBucket (\s a -> s { _poBucket = a })
poCacheControl :: Lens' PutObject (Maybe Text)
poCacheControl = lens _poCacheControl (\s a -> s { _poCacheControl = a })
poContentDisposition :: Lens' PutObject (Maybe Text)
poContentDisposition =
lens _poContentDisposition (\s a -> s { _poContentDisposition = a })
poContentEncoding :: Lens' PutObject (Maybe Text)
poContentEncoding =
lens _poContentEncoding (\s a -> s { _poContentEncoding = a })
poContentLanguage :: Lens' PutObject (Maybe Text)
poContentLanguage =
lens _poContentLanguage (\s a -> s { _poContentLanguage = a })
poContentLength :: Lens' PutObject (Maybe Int)
poContentLength = lens _poContentLength (\s a -> s { _poContentLength = a })
poContentMD5 :: Lens' PutObject (Maybe Text)
poContentMD5 = lens _poContentMD5 (\s a -> s { _poContentMD5 = a })
poContentType :: Lens' PutObject (Maybe Text)
poContentType = lens _poContentType (\s a -> s { _poContentType = a })
poExpires :: Lens' PutObject (Maybe UTCTime)
poExpires = lens _poExpires (\s a -> s { _poExpires = a }) . mapping _Time
poGrantFullControl :: Lens' PutObject (Maybe Text)
poGrantFullControl =
lens _poGrantFullControl (\s a -> s { _poGrantFullControl = a })
poGrantRead :: Lens' PutObject (Maybe Text)
poGrantRead = lens _poGrantRead (\s a -> s { _poGrantRead = a })
poGrantReadACP :: Lens' PutObject (Maybe Text)
poGrantReadACP = lens _poGrantReadACP (\s a -> s { _poGrantReadACP = a })
poGrantWriteACP :: Lens' PutObject (Maybe Text)
poGrantWriteACP = lens _poGrantWriteACP (\s a -> s { _poGrantWriteACP = a })
poKey :: Lens' PutObject Text
poKey = lens _poKey (\s a -> s { _poKey = a })
poMetadata :: Lens' PutObject (HashMap (CI Text) Text)
poMetadata = lens _poMetadata (\s a -> s { _poMetadata = a }) . _Map
poSSECustomerAlgorithm :: Lens' PutObject (Maybe Text)
poSSECustomerAlgorithm =
lens _poSSECustomerAlgorithm (\s a -> s { _poSSECustomerAlgorithm = a })
poSSECustomerKey :: Lens' PutObject (Maybe Text)
poSSECustomerKey = lens _poSSECustomerKey (\s a -> s { _poSSECustomerKey = a }) . mapping _Sensitive
poSSECustomerKeyMD5 :: Lens' PutObject (Maybe Text)
poSSECustomerKeyMD5 =
lens _poSSECustomerKeyMD5 (\s a -> s { _poSSECustomerKeyMD5 = a })
poSSEKMSKeyId :: Lens' PutObject (Maybe Text)
poSSEKMSKeyId = lens _poSSEKMSKeyId (\s a -> s { _poSSEKMSKeyId = a }) . mapping _Sensitive
poServerSideEncryption :: Lens' PutObject (Maybe ServerSideEncryption)
poServerSideEncryption =
lens _poServerSideEncryption (\s a -> s { _poServerSideEncryption = a })
poStorageClass :: Lens' PutObject (Maybe StorageClass)
poStorageClass = lens _poStorageClass (\s a -> s { _poStorageClass = a })
poWebsiteRedirectLocation :: Lens' PutObject (Maybe Text)
poWebsiteRedirectLocation =
lens _poWebsiteRedirectLocation
(\s a -> s { _poWebsiteRedirectLocation = a })
data PutObjectResponse = PutObjectResponse
{ _porETag :: Maybe Text
, _porExpiration :: Maybe RFC822
, _porSSECustomerAlgorithm :: Maybe Text
, _porSSECustomerKeyMD5 :: Maybe Text
, _porSSEKMSKeyId :: Maybe (Sensitive Text)
, _porServerSideEncryption :: Maybe ServerSideEncryption
, _porVersionId :: Maybe Text
} deriving (Eq, Show)
putObjectResponse :: PutObjectResponse
putObjectResponse = PutObjectResponse
{ _porExpiration = Nothing
, _porETag = Nothing
, _porServerSideEncryption = Nothing
, _porVersionId = Nothing
, _porSSECustomerAlgorithm = Nothing
, _porSSECustomerKeyMD5 = Nothing
, _porSSEKMSKeyId = Nothing
}
porETag :: Lens' PutObjectResponse (Maybe Text)
porETag = lens _porETag (\s a -> s { _porETag = a })
porExpiration :: Lens' PutObjectResponse (Maybe UTCTime)
porExpiration = lens _porExpiration (\s a -> s { _porExpiration = a }) . mapping _Time
porSSECustomerAlgorithm :: Lens' PutObjectResponse (Maybe Text)
porSSECustomerAlgorithm =
lens _porSSECustomerAlgorithm (\s a -> s { _porSSECustomerAlgorithm = a })
porSSECustomerKeyMD5 :: Lens' PutObjectResponse (Maybe Text)
porSSECustomerKeyMD5 =
lens _porSSECustomerKeyMD5 (\s a -> s { _porSSECustomerKeyMD5 = a })
porSSEKMSKeyId :: Lens' PutObjectResponse (Maybe Text)
porSSEKMSKeyId = lens _porSSEKMSKeyId (\s a -> s { _porSSEKMSKeyId = a }) . mapping _Sensitive
porServerSideEncryption :: Lens' PutObjectResponse (Maybe ServerSideEncryption)
porServerSideEncryption =
lens _porServerSideEncryption (\s a -> s { _porServerSideEncryption = a })
porVersionId :: Lens' PutObjectResponse (Maybe Text)
porVersionId = lens _porVersionId (\s a -> s { _porVersionId = a })
instance ToPath PutObject where
toPath PutObject{..} = mconcat
[ "/"
, toText _poBucket
, "/"
, toText _poKey
]
instance ToQuery PutObject where
toQuery = const mempty
instance ToHeaders PutObject where
toHeaders PutObject{..} = mconcat
[ "x-amz-acl" =: _poACL
, "Cache-Control" =: _poCacheControl
, "Content-Disposition" =: _poContentDisposition
, "Content-Encoding" =: _poContentEncoding
, "Content-Language" =: _poContentLanguage
, "Content-Length" =: _poContentLength
, "Content-MD5" =: _poContentMD5
, "Content-Type" =: _poContentType
, "Expires" =: _poExpires
, "x-amz-grant-full-control" =: _poGrantFullControl
, "x-amz-grant-read" =: _poGrantRead
, "x-amz-grant-read-acp" =: _poGrantReadACP
, "x-amz-grant-write-acp" =: _poGrantWriteACP
, "x-amz-meta-" =: _poMetadata
, "x-amz-server-side-encryption" =: _poServerSideEncryption
, "x-amz-storage-class" =: _poStorageClass
, "x-amz-website-redirect-location" =: _poWebsiteRedirectLocation
, "x-amz-server-side-encryption-customer-algorithm" =: _poSSECustomerAlgorithm
, "x-amz-server-side-encryption-customer-key" =: _poSSECustomerKey
, "x-amz-server-side-encryption-customer-key-MD5" =: _poSSECustomerKeyMD5
, "x-amz-server-side-encryption-aws-kms-key-id" =: _poSSEKMSKeyId
]
instance ToBody PutObject where
toBody = toBody . _poBody
instance AWSRequest PutObject where
type Sv PutObject = S3
type Rs PutObject = PutObjectResponse
request = stream PUT
response = headerResponse $ \h -> PutObjectResponse
<$> h ~:? "ETag"
<*> h ~:? "x-amz-expiration"
<*> 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"
<*> h ~:? "x-amz-version-id"