{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.S3.PutBucketCors
(
PutBucketCors (..),
newPutBucketCors,
putBucketCors_contentMD5,
putBucketCors_expectedBucketOwner,
putBucketCors_bucket,
putBucketCors_cORSConfiguration,
PutBucketCorsResponse (..),
newPutBucketCorsResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types
data PutBucketCors = PutBucketCors'
{
PutBucketCors -> Maybe Text
contentMD5 :: Prelude.Maybe Prelude.Text,
PutBucketCors -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
PutBucketCors -> BucketName
bucket :: BucketName,
PutBucketCors -> CORSConfiguration
cORSConfiguration :: CORSConfiguration
}
deriving (PutBucketCors -> PutBucketCors -> Bool
(PutBucketCors -> PutBucketCors -> Bool)
-> (PutBucketCors -> PutBucketCors -> Bool) -> Eq PutBucketCors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBucketCors -> PutBucketCors -> Bool
$c/= :: PutBucketCors -> PutBucketCors -> Bool
== :: PutBucketCors -> PutBucketCors -> Bool
$c== :: PutBucketCors -> PutBucketCors -> Bool
Prelude.Eq, ReadPrec [PutBucketCors]
ReadPrec PutBucketCors
Int -> ReadS PutBucketCors
ReadS [PutBucketCors]
(Int -> ReadS PutBucketCors)
-> ReadS [PutBucketCors]
-> ReadPrec PutBucketCors
-> ReadPrec [PutBucketCors]
-> Read PutBucketCors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutBucketCors]
$creadListPrec :: ReadPrec [PutBucketCors]
readPrec :: ReadPrec PutBucketCors
$creadPrec :: ReadPrec PutBucketCors
readList :: ReadS [PutBucketCors]
$creadList :: ReadS [PutBucketCors]
readsPrec :: Int -> ReadS PutBucketCors
$creadsPrec :: Int -> ReadS PutBucketCors
Prelude.Read, Int -> PutBucketCors -> ShowS
[PutBucketCors] -> ShowS
PutBucketCors -> String
(Int -> PutBucketCors -> ShowS)
-> (PutBucketCors -> String)
-> ([PutBucketCors] -> ShowS)
-> Show PutBucketCors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBucketCors] -> ShowS
$cshowList :: [PutBucketCors] -> ShowS
show :: PutBucketCors -> String
$cshow :: PutBucketCors -> String
showsPrec :: Int -> PutBucketCors -> ShowS
$cshowsPrec :: Int -> PutBucketCors -> ShowS
Prelude.Show, (forall x. PutBucketCors -> Rep PutBucketCors x)
-> (forall x. Rep PutBucketCors x -> PutBucketCors)
-> Generic PutBucketCors
forall x. Rep PutBucketCors x -> PutBucketCors
forall x. PutBucketCors -> Rep PutBucketCors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutBucketCors x -> PutBucketCors
$cfrom :: forall x. PutBucketCors -> Rep PutBucketCors x
Prelude.Generic)
newPutBucketCors ::
BucketName ->
CORSConfiguration ->
PutBucketCors
newPutBucketCors :: BucketName -> CORSConfiguration -> PutBucketCors
newPutBucketCors BucketName
pBucket_ CORSConfiguration
pCORSConfiguration_ =
PutBucketCors' :: Maybe Text
-> Maybe Text -> BucketName -> CORSConfiguration -> PutBucketCors
PutBucketCors'
{ $sel:contentMD5:PutBucketCors' :: Maybe Text
contentMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expectedBucketOwner:PutBucketCors' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:PutBucketCors' :: BucketName
bucket = BucketName
pBucket_,
$sel:cORSConfiguration:PutBucketCors' :: CORSConfiguration
cORSConfiguration = CORSConfiguration
pCORSConfiguration_
}
putBucketCors_contentMD5 :: Lens.Lens' PutBucketCors (Prelude.Maybe Prelude.Text)
putBucketCors_contentMD5 :: (Maybe Text -> f (Maybe Text)) -> PutBucketCors -> f PutBucketCors
putBucketCors_contentMD5 = (PutBucketCors -> Maybe Text)
-> (PutBucketCors -> Maybe Text -> PutBucketCors)
-> Lens PutBucketCors PutBucketCors (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketCors' {Maybe Text
contentMD5 :: Maybe Text
$sel:contentMD5:PutBucketCors' :: PutBucketCors -> Maybe Text
contentMD5} -> Maybe Text
contentMD5) (\s :: PutBucketCors
s@PutBucketCors' {} Maybe Text
a -> PutBucketCors
s {$sel:contentMD5:PutBucketCors' :: Maybe Text
contentMD5 = Maybe Text
a} :: PutBucketCors)
putBucketCors_expectedBucketOwner :: Lens.Lens' PutBucketCors (Prelude.Maybe Prelude.Text)
putBucketCors_expectedBucketOwner :: (Maybe Text -> f (Maybe Text)) -> PutBucketCors -> f PutBucketCors
putBucketCors_expectedBucketOwner = (PutBucketCors -> Maybe Text)
-> (PutBucketCors -> Maybe Text -> PutBucketCors)
-> Lens PutBucketCors PutBucketCors (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketCors' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:PutBucketCors' :: PutBucketCors -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: PutBucketCors
s@PutBucketCors' {} Maybe Text
a -> PutBucketCors
s {$sel:expectedBucketOwner:PutBucketCors' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: PutBucketCors)
putBucketCors_bucket :: Lens.Lens' PutBucketCors BucketName
putBucketCors_bucket :: (BucketName -> f BucketName) -> PutBucketCors -> f PutBucketCors
putBucketCors_bucket = (PutBucketCors -> BucketName)
-> (PutBucketCors -> BucketName -> PutBucketCors)
-> Lens PutBucketCors PutBucketCors BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketCors' {BucketName
bucket :: BucketName
$sel:bucket:PutBucketCors' :: PutBucketCors -> BucketName
bucket} -> BucketName
bucket) (\s :: PutBucketCors
s@PutBucketCors' {} BucketName
a -> PutBucketCors
s {$sel:bucket:PutBucketCors' :: BucketName
bucket = BucketName
a} :: PutBucketCors)
putBucketCors_cORSConfiguration :: Lens.Lens' PutBucketCors CORSConfiguration
putBucketCors_cORSConfiguration :: (CORSConfiguration -> f CORSConfiguration)
-> PutBucketCors -> f PutBucketCors
putBucketCors_cORSConfiguration = (PutBucketCors -> CORSConfiguration)
-> (PutBucketCors -> CORSConfiguration -> PutBucketCors)
-> Lens
PutBucketCors PutBucketCors CORSConfiguration CORSConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketCors' {CORSConfiguration
cORSConfiguration :: CORSConfiguration
$sel:cORSConfiguration:PutBucketCors' :: PutBucketCors -> CORSConfiguration
cORSConfiguration} -> CORSConfiguration
cORSConfiguration) (\s :: PutBucketCors
s@PutBucketCors' {} CORSConfiguration
a -> PutBucketCors
s {$sel:cORSConfiguration:PutBucketCors' :: CORSConfiguration
cORSConfiguration = CORSConfiguration
a} :: PutBucketCors)
instance Core.AWSRequest PutBucketCors where
type
AWSResponse PutBucketCors =
PutBucketCorsResponse
request :: PutBucketCors -> Request PutBucketCors
request =
Request PutBucketCors -> Request PutBucketCors
forall a. Request a -> Request a
Request.contentMD5Header
(Request PutBucketCors -> Request PutBucketCors)
-> (PutBucketCors -> Request PutBucketCors)
-> PutBucketCors
-> Request PutBucketCors
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Request PutBucketCors -> Request PutBucketCors
forall a. Request a -> Request a
Request.s3vhost
(Request PutBucketCors -> Request PutBucketCors)
-> (PutBucketCors -> Request PutBucketCors)
-> PutBucketCors
-> Request PutBucketCors
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> PutBucketCors -> Request PutBucketCors
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
response :: Logger
-> Service
-> Proxy PutBucketCors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBucketCors)))
response =
AWSResponse PutBucketCors
-> Logger
-> Service
-> Proxy PutBucketCors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBucketCors)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutBucketCors
PutBucketCorsResponse
PutBucketCorsResponse'
instance Prelude.Hashable PutBucketCors
instance Prelude.NFData PutBucketCors
instance Core.ToElement PutBucketCors where
toElement :: PutBucketCors -> Element
toElement PutBucketCors' {Maybe Text
BucketName
CORSConfiguration
cORSConfiguration :: CORSConfiguration
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
$sel:cORSConfiguration:PutBucketCors' :: PutBucketCors -> CORSConfiguration
$sel:bucket:PutBucketCors' :: PutBucketCors -> BucketName
$sel:expectedBucketOwner:PutBucketCors' :: PutBucketCors -> Maybe Text
$sel:contentMD5:PutBucketCors' :: PutBucketCors -> Maybe Text
..} =
Name -> CORSConfiguration -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://s3.amazonaws.com/doc/2006-03-01/}CORSConfiguration"
CORSConfiguration
cORSConfiguration
instance Core.ToHeaders PutBucketCors where
toHeaders :: PutBucketCors -> [Header]
toHeaders PutBucketCors' {Maybe Text
BucketName
CORSConfiguration
cORSConfiguration :: CORSConfiguration
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
$sel:cORSConfiguration:PutBucketCors' :: PutBucketCors -> CORSConfiguration
$sel:bucket:PutBucketCors' :: PutBucketCors -> BucketName
$sel:expectedBucketOwner:PutBucketCors' :: PutBucketCors -> Maybe Text
$sel:contentMD5:PutBucketCors' :: PutBucketCors -> Maybe Text
..} =
[[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-MD5" HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
contentMD5,
HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
expectedBucketOwner
]
instance Core.ToPath PutBucketCors where
toPath :: PutBucketCors -> ByteString
toPath PutBucketCors' {Maybe Text
BucketName
CORSConfiguration
cORSConfiguration :: CORSConfiguration
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
$sel:cORSConfiguration:PutBucketCors' :: PutBucketCors -> CORSConfiguration
$sel:bucket:PutBucketCors' :: PutBucketCors -> BucketName
$sel:expectedBucketOwner:PutBucketCors' :: PutBucketCors -> Maybe Text
$sel:contentMD5:PutBucketCors' :: PutBucketCors -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket]
instance Core.ToQuery PutBucketCors where
toQuery :: PutBucketCors -> QueryString
toQuery = QueryString -> PutBucketCors -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"cors"])
data PutBucketCorsResponse = PutBucketCorsResponse'
{
}
deriving (PutBucketCorsResponse -> PutBucketCorsResponse -> Bool
(PutBucketCorsResponse -> PutBucketCorsResponse -> Bool)
-> (PutBucketCorsResponse -> PutBucketCorsResponse -> Bool)
-> Eq PutBucketCorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBucketCorsResponse -> PutBucketCorsResponse -> Bool
$c/= :: PutBucketCorsResponse -> PutBucketCorsResponse -> Bool
== :: PutBucketCorsResponse -> PutBucketCorsResponse -> Bool
$c== :: PutBucketCorsResponse -> PutBucketCorsResponse -> Bool
Prelude.Eq, ReadPrec [PutBucketCorsResponse]
ReadPrec PutBucketCorsResponse
Int -> ReadS PutBucketCorsResponse
ReadS [PutBucketCorsResponse]
(Int -> ReadS PutBucketCorsResponse)
-> ReadS [PutBucketCorsResponse]
-> ReadPrec PutBucketCorsResponse
-> ReadPrec [PutBucketCorsResponse]
-> Read PutBucketCorsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutBucketCorsResponse]
$creadListPrec :: ReadPrec [PutBucketCorsResponse]
readPrec :: ReadPrec PutBucketCorsResponse
$creadPrec :: ReadPrec PutBucketCorsResponse
readList :: ReadS [PutBucketCorsResponse]
$creadList :: ReadS [PutBucketCorsResponse]
readsPrec :: Int -> ReadS PutBucketCorsResponse
$creadsPrec :: Int -> ReadS PutBucketCorsResponse
Prelude.Read, Int -> PutBucketCorsResponse -> ShowS
[PutBucketCorsResponse] -> ShowS
PutBucketCorsResponse -> String
(Int -> PutBucketCorsResponse -> ShowS)
-> (PutBucketCorsResponse -> String)
-> ([PutBucketCorsResponse] -> ShowS)
-> Show PutBucketCorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBucketCorsResponse] -> ShowS
$cshowList :: [PutBucketCorsResponse] -> ShowS
show :: PutBucketCorsResponse -> String
$cshow :: PutBucketCorsResponse -> String
showsPrec :: Int -> PutBucketCorsResponse -> ShowS
$cshowsPrec :: Int -> PutBucketCorsResponse -> ShowS
Prelude.Show, (forall x. PutBucketCorsResponse -> Rep PutBucketCorsResponse x)
-> (forall x. Rep PutBucketCorsResponse x -> PutBucketCorsResponse)
-> Generic PutBucketCorsResponse
forall x. Rep PutBucketCorsResponse x -> PutBucketCorsResponse
forall x. PutBucketCorsResponse -> Rep PutBucketCorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutBucketCorsResponse x -> PutBucketCorsResponse
$cfrom :: forall x. PutBucketCorsResponse -> Rep PutBucketCorsResponse x
Prelude.Generic)
newPutBucketCorsResponse ::
PutBucketCorsResponse
newPutBucketCorsResponse :: PutBucketCorsResponse
newPutBucketCorsResponse = PutBucketCorsResponse
PutBucketCorsResponse'
instance Prelude.NFData PutBucketCorsResponse