{-# 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.GetBucketNotificationConfiguration
(
GetBucketNotificationConfiguration (..),
newGetBucketNotificationConfiguration,
getBucketNotificationConfiguration_expectedBucketOwner,
getBucketNotificationConfiguration_bucket,
NotificationConfiguration (..),
newNotificationConfiguration,
notificationConfiguration_queueConfigurations,
notificationConfiguration_topicConfigurations,
notificationConfiguration_lambdaFunctionConfigurations,
)
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 GetBucketNotificationConfiguration = GetBucketNotificationConfiguration'
{
GetBucketNotificationConfiguration -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetBucketNotificationConfiguration -> BucketName
bucket :: BucketName
}
deriving (GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool
(GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool)
-> (GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool)
-> Eq GetBucketNotificationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool
$c/= :: GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool
== :: GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool
$c== :: GetBucketNotificationConfiguration
-> GetBucketNotificationConfiguration -> Bool
Prelude.Eq, ReadPrec [GetBucketNotificationConfiguration]
ReadPrec GetBucketNotificationConfiguration
Int -> ReadS GetBucketNotificationConfiguration
ReadS [GetBucketNotificationConfiguration]
(Int -> ReadS GetBucketNotificationConfiguration)
-> ReadS [GetBucketNotificationConfiguration]
-> ReadPrec GetBucketNotificationConfiguration
-> ReadPrec [GetBucketNotificationConfiguration]
-> Read GetBucketNotificationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketNotificationConfiguration]
$creadListPrec :: ReadPrec [GetBucketNotificationConfiguration]
readPrec :: ReadPrec GetBucketNotificationConfiguration
$creadPrec :: ReadPrec GetBucketNotificationConfiguration
readList :: ReadS [GetBucketNotificationConfiguration]
$creadList :: ReadS [GetBucketNotificationConfiguration]
readsPrec :: Int -> ReadS GetBucketNotificationConfiguration
$creadsPrec :: Int -> ReadS GetBucketNotificationConfiguration
Prelude.Read, Int -> GetBucketNotificationConfiguration -> ShowS
[GetBucketNotificationConfiguration] -> ShowS
GetBucketNotificationConfiguration -> String
(Int -> GetBucketNotificationConfiguration -> ShowS)
-> (GetBucketNotificationConfiguration -> String)
-> ([GetBucketNotificationConfiguration] -> ShowS)
-> Show GetBucketNotificationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketNotificationConfiguration] -> ShowS
$cshowList :: [GetBucketNotificationConfiguration] -> ShowS
show :: GetBucketNotificationConfiguration -> String
$cshow :: GetBucketNotificationConfiguration -> String
showsPrec :: Int -> GetBucketNotificationConfiguration -> ShowS
$cshowsPrec :: Int -> GetBucketNotificationConfiguration -> ShowS
Prelude.Show, (forall x.
GetBucketNotificationConfiguration
-> Rep GetBucketNotificationConfiguration x)
-> (forall x.
Rep GetBucketNotificationConfiguration x
-> GetBucketNotificationConfiguration)
-> Generic GetBucketNotificationConfiguration
forall x.
Rep GetBucketNotificationConfiguration x
-> GetBucketNotificationConfiguration
forall x.
GetBucketNotificationConfiguration
-> Rep GetBucketNotificationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketNotificationConfiguration x
-> GetBucketNotificationConfiguration
$cfrom :: forall x.
GetBucketNotificationConfiguration
-> Rep GetBucketNotificationConfiguration x
Prelude.Generic)
newGetBucketNotificationConfiguration ::
BucketName ->
GetBucketNotificationConfiguration
newGetBucketNotificationConfiguration :: BucketName -> GetBucketNotificationConfiguration
newGetBucketNotificationConfiguration BucketName
pBucket_ =
GetBucketNotificationConfiguration' :: Maybe Text -> BucketName -> GetBucketNotificationConfiguration
GetBucketNotificationConfiguration'
{ $sel:expectedBucketOwner:GetBucketNotificationConfiguration' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketNotificationConfiguration' :: BucketName
bucket = BucketName
pBucket_
}
getBucketNotificationConfiguration_expectedBucketOwner :: Lens.Lens' GetBucketNotificationConfiguration (Prelude.Maybe Prelude.Text)
getBucketNotificationConfiguration_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketNotificationConfiguration
-> f GetBucketNotificationConfiguration
getBucketNotificationConfiguration_expectedBucketOwner = (GetBucketNotificationConfiguration -> Maybe Text)
-> (GetBucketNotificationConfiguration
-> Maybe Text -> GetBucketNotificationConfiguration)
-> Lens
GetBucketNotificationConfiguration
GetBucketNotificationConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketNotificationConfiguration' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketNotificationConfiguration' :: GetBucketNotificationConfiguration -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketNotificationConfiguration
s@GetBucketNotificationConfiguration' {} Maybe Text
a -> GetBucketNotificationConfiguration
s {$sel:expectedBucketOwner:GetBucketNotificationConfiguration' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketNotificationConfiguration)
getBucketNotificationConfiguration_bucket :: Lens.Lens' GetBucketNotificationConfiguration BucketName
getBucketNotificationConfiguration_bucket :: (BucketName -> f BucketName)
-> GetBucketNotificationConfiguration
-> f GetBucketNotificationConfiguration
getBucketNotificationConfiguration_bucket = (GetBucketNotificationConfiguration -> BucketName)
-> (GetBucketNotificationConfiguration
-> BucketName -> GetBucketNotificationConfiguration)
-> Lens
GetBucketNotificationConfiguration
GetBucketNotificationConfiguration
BucketName
BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketNotificationConfiguration' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketNotificationConfiguration' :: GetBucketNotificationConfiguration -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketNotificationConfiguration
s@GetBucketNotificationConfiguration' {} BucketName
a -> GetBucketNotificationConfiguration
s {$sel:bucket:GetBucketNotificationConfiguration' :: BucketName
bucket = BucketName
a} :: GetBucketNotificationConfiguration)
instance
Core.AWSRequest
GetBucketNotificationConfiguration
where
type
AWSResponse GetBucketNotificationConfiguration =
NotificationConfiguration
request :: GetBucketNotificationConfiguration
-> Request GetBucketNotificationConfiguration
request =
Request GetBucketNotificationConfiguration
-> Request GetBucketNotificationConfiguration
forall a. Request a -> Request a
Request.s3vhost
(Request GetBucketNotificationConfiguration
-> Request GetBucketNotificationConfiguration)
-> (GetBucketNotificationConfiguration
-> Request GetBucketNotificationConfiguration)
-> GetBucketNotificationConfiguration
-> Request GetBucketNotificationConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> GetBucketNotificationConfiguration
-> Request GetBucketNotificationConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketNotificationConfiguration
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse GetBucketNotificationConfiguration)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetBucketNotificationConfiguration))
-> Logger
-> Service
-> Proxy GetBucketNotificationConfiguration
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse GetBucketNotificationConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String NotificationConfiguration
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance
Prelude.Hashable
GetBucketNotificationConfiguration
instance
Prelude.NFData
GetBucketNotificationConfiguration
instance
Core.ToHeaders
GetBucketNotificationConfiguration
where
toHeaders :: GetBucketNotificationConfiguration -> ResponseHeaders
toHeaders GetBucketNotificationConfiguration' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketNotificationConfiguration' :: GetBucketNotificationConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketNotificationConfiguration' :: GetBucketNotificationConfiguration -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
]
instance
Core.ToPath
GetBucketNotificationConfiguration
where
toPath :: GetBucketNotificationConfiguration -> ByteString
toPath GetBucketNotificationConfiguration' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketNotificationConfiguration' :: GetBucketNotificationConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketNotificationConfiguration' :: GetBucketNotificationConfiguration -> 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
GetBucketNotificationConfiguration
where
toQuery :: GetBucketNotificationConfiguration -> QueryString
toQuery =
QueryString -> GetBucketNotificationConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"notification"])