module Network.AWS.S3.CreateBucket
(
createBucket
, CreateBucket
, cbGrantReadACP
, cbGrantWriteACP
, cbGrantRead
, cbGrantFullControl
, cbCreateBucketConfiguration
, cbGrantWrite
, cbACL
, cbBucket
, createBucketResponse
, CreateBucketResponse
, cbrsLocation
, cbrsResponseStatus
) 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 CreateBucket = CreateBucket'
{ _cbGrantReadACP :: !(Maybe Text)
, _cbGrantWriteACP :: !(Maybe Text)
, _cbGrantRead :: !(Maybe Text)
, _cbGrantFullControl :: !(Maybe Text)
, _cbCreateBucketConfiguration :: !(Maybe CreateBucketConfiguration)
, _cbGrantWrite :: !(Maybe Text)
, _cbACL :: !(Maybe BucketCannedACL)
, _cbBucket :: !BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createBucket
:: BucketName
-> CreateBucket
createBucket pBucket_ =
CreateBucket'
{ _cbGrantReadACP = Nothing
, _cbGrantWriteACP = Nothing
, _cbGrantRead = Nothing
, _cbGrantFullControl = Nothing
, _cbCreateBucketConfiguration = Nothing
, _cbGrantWrite = Nothing
, _cbACL = Nothing
, _cbBucket = pBucket_
}
cbGrantReadACP :: Lens' CreateBucket (Maybe Text)
cbGrantReadACP = lens _cbGrantReadACP (\ s a -> s{_cbGrantReadACP = a});
cbGrantWriteACP :: Lens' CreateBucket (Maybe Text)
cbGrantWriteACP = lens _cbGrantWriteACP (\ s a -> s{_cbGrantWriteACP = a});
cbGrantRead :: Lens' CreateBucket (Maybe Text)
cbGrantRead = lens _cbGrantRead (\ s a -> s{_cbGrantRead = a});
cbGrantFullControl :: Lens' CreateBucket (Maybe Text)
cbGrantFullControl = lens _cbGrantFullControl (\ s a -> s{_cbGrantFullControl = a});
cbCreateBucketConfiguration :: Lens' CreateBucket (Maybe CreateBucketConfiguration)
cbCreateBucketConfiguration = lens _cbCreateBucketConfiguration (\ s a -> s{_cbCreateBucketConfiguration = a});
cbGrantWrite :: Lens' CreateBucket (Maybe Text)
cbGrantWrite = lens _cbGrantWrite (\ s a -> s{_cbGrantWrite = a});
cbACL :: Lens' CreateBucket (Maybe BucketCannedACL)
cbACL = lens _cbACL (\ s a -> s{_cbACL = a});
cbBucket :: Lens' CreateBucket BucketName
cbBucket = lens _cbBucket (\ s a -> s{_cbBucket = a});
instance AWSRequest CreateBucket where
type Rs CreateBucket = CreateBucketResponse
request = putXML s3
response
= receiveEmpty
(\ s h x ->
CreateBucketResponse' <$>
(h .#? "Location") <*> (pure (fromEnum s)))
instance Hashable CreateBucket where
instance NFData CreateBucket where
instance ToElement CreateBucket where
toElement
= mkElement
"{http://s3.amazonaws.com/doc/2006-03-01/}CreateBucketConfiguration"
.
_cbCreateBucketConfiguration
instance ToHeaders CreateBucket where
toHeaders CreateBucket'{..}
= mconcat
["x-amz-grant-read-acp" =# _cbGrantReadACP,
"x-amz-grant-write-acp" =# _cbGrantWriteACP,
"x-amz-grant-read" =# _cbGrantRead,
"x-amz-grant-full-control" =# _cbGrantFullControl,
"x-amz-grant-write" =# _cbGrantWrite,
"x-amz-acl" =# _cbACL]
instance ToPath CreateBucket where
toPath CreateBucket'{..}
= mconcat ["/", toBS _cbBucket]
instance ToQuery CreateBucket where
toQuery = const mempty
data CreateBucketResponse = CreateBucketResponse'
{ _cbrsLocation :: !(Maybe Text)
, _cbrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createBucketResponse
:: Int
-> CreateBucketResponse
createBucketResponse pResponseStatus_ =
CreateBucketResponse'
{_cbrsLocation = Nothing, _cbrsResponseStatus = pResponseStatus_}
cbrsLocation :: Lens' CreateBucketResponse (Maybe Text)
cbrsLocation = lens _cbrsLocation (\ s a -> s{_cbrsLocation = a});
cbrsResponseStatus :: Lens' CreateBucketResponse Int
cbrsResponseStatus = lens _cbrsResponseStatus (\ s a -> s{_cbrsResponseStatus = a});
instance NFData CreateBucketResponse where