{-# 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.PutBucketCORS
(
putBucketCORS
, PutBucketCORS
, pbcContentMD5
, pbcBucket
, pbcCORSConfiguration
, putBucketCORSResponse
, PutBucketCORSResponse
) 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 PutBucketCORS = PutBucketCORS'
{ _pbcContentMD5 :: !(Maybe Text)
, _pbcBucket :: !BucketName
, _pbcCORSConfiguration :: !CORSConfiguration
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putBucketCORS
:: BucketName
-> CORSConfiguration
-> PutBucketCORS
putBucketCORS pBucket_ pCORSConfiguration_ =
PutBucketCORS'
{ _pbcContentMD5 = Nothing
, _pbcBucket = pBucket_
, _pbcCORSConfiguration = pCORSConfiguration_
}
pbcContentMD5 :: Lens' PutBucketCORS (Maybe Text)
pbcContentMD5 = lens _pbcContentMD5 (\ s a -> s{_pbcContentMD5 = a})
pbcBucket :: Lens' PutBucketCORS BucketName
pbcBucket = lens _pbcBucket (\ s a -> s{_pbcBucket = a})
pbcCORSConfiguration :: Lens' PutBucketCORS CORSConfiguration
pbcCORSConfiguration = lens _pbcCORSConfiguration (\ s a -> s{_pbcCORSConfiguration = a})
instance AWSRequest PutBucketCORS where
type Rs PutBucketCORS = PutBucketCORSResponse
request = putXML s3
response = receiveNull PutBucketCORSResponse'
instance Hashable PutBucketCORS where
instance NFData PutBucketCORS where
instance ToElement PutBucketCORS where
toElement
= mkElement
"{http://s3.amazonaws.com/doc/2006-03-01/}CORSConfiguration"
.
_pbcCORSConfiguration
instance ToHeaders PutBucketCORS where
toHeaders PutBucketCORS'{..}
= mconcat ["Content-MD5" =# _pbcContentMD5]
instance ToPath PutBucketCORS where
toPath PutBucketCORS'{..}
= mconcat ["/", toBS _pbcBucket]
instance ToQuery PutBucketCORS where
toQuery = const (mconcat ["cors"])
data PutBucketCORSResponse =
PutBucketCORSResponse'
deriving (Eq, Read, Show, Data, Typeable, Generic)
putBucketCORSResponse
:: PutBucketCORSResponse
putBucketCORSResponse = PutBucketCORSResponse'
instance NFData PutBucketCORSResponse where