{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SNS.Types.Subscription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Subscription = Subscription'
{
Subscription -> Maybe Text
protocol :: Prelude.Maybe Prelude.Text,
Subscription -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
Subscription -> Maybe Text
topicArn :: Prelude.Maybe Prelude.Text,
Subscription -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text,
Subscription -> Maybe Text
subscriptionArn :: Prelude.Maybe Prelude.Text
}
deriving (Subscription -> Subscription -> Bool
(Subscription -> Subscription -> Bool)
-> (Subscription -> Subscription -> Bool) -> Eq Subscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Subscription -> Subscription -> Bool
$c/= :: Subscription -> Subscription -> Bool
== :: Subscription -> Subscription -> Bool
$c== :: Subscription -> Subscription -> Bool
Prelude.Eq, ReadPrec [Subscription]
ReadPrec Subscription
Int -> ReadS Subscription
ReadS [Subscription]
(Int -> ReadS Subscription)
-> ReadS [Subscription]
-> ReadPrec Subscription
-> ReadPrec [Subscription]
-> Read Subscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Subscription]
$creadListPrec :: ReadPrec [Subscription]
readPrec :: ReadPrec Subscription
$creadPrec :: ReadPrec Subscription
readList :: ReadS [Subscription]
$creadList :: ReadS [Subscription]
readsPrec :: Int -> ReadS Subscription
$creadsPrec :: Int -> ReadS Subscription
Prelude.Read, Int -> Subscription -> ShowS
[Subscription] -> ShowS
Subscription -> String
(Int -> Subscription -> ShowS)
-> (Subscription -> String)
-> ([Subscription] -> ShowS)
-> Show Subscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Subscription] -> ShowS
$cshowList :: [Subscription] -> ShowS
show :: Subscription -> String
$cshow :: Subscription -> String
showsPrec :: Int -> Subscription -> ShowS
$cshowsPrec :: Int -> Subscription -> ShowS
Prelude.Show, (forall x. Subscription -> Rep Subscription x)
-> (forall x. Rep Subscription x -> Subscription)
-> Generic Subscription
forall x. Rep Subscription x -> Subscription
forall x. Subscription -> Rep Subscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Subscription x -> Subscription
$cfrom :: forall x. Subscription -> Rep Subscription x
Prelude.Generic)
newSubscription ::
Subscription
newSubscription :: Subscription
newSubscription =
Subscription' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Subscription
Subscription'
{ $sel:protocol:Subscription' :: Maybe Text
protocol = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:owner:Subscription' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:topicArn:Subscription' :: Maybe Text
topicArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:endpoint:Subscription' :: Maybe Text
endpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:subscriptionArn:Subscription' :: Maybe Text
subscriptionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
subscription_protocol :: Lens.Lens' Subscription (Prelude.Maybe Prelude.Text)
subscription_protocol :: (Maybe Text -> f (Maybe Text)) -> Subscription -> f Subscription
subscription_protocol = (Subscription -> Maybe Text)
-> (Subscription -> Maybe Text -> Subscription)
-> Lens Subscription Subscription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Maybe Text
protocol :: Maybe Text
$sel:protocol:Subscription' :: Subscription -> Maybe Text
protocol} -> Maybe Text
protocol) (\s :: Subscription
s@Subscription' {} Maybe Text
a -> Subscription
s {$sel:protocol:Subscription' :: Maybe Text
protocol = Maybe Text
a} :: Subscription)
subscription_owner :: Lens.Lens' Subscription (Prelude.Maybe Prelude.Text)
subscription_owner :: (Maybe Text -> f (Maybe Text)) -> Subscription -> f Subscription
subscription_owner = (Subscription -> Maybe Text)
-> (Subscription -> Maybe Text -> Subscription)
-> Lens Subscription Subscription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Maybe Text
owner :: Maybe Text
$sel:owner:Subscription' :: Subscription -> Maybe Text
owner} -> Maybe Text
owner) (\s :: Subscription
s@Subscription' {} Maybe Text
a -> Subscription
s {$sel:owner:Subscription' :: Maybe Text
owner = Maybe Text
a} :: Subscription)
subscription_topicArn :: Lens.Lens' Subscription (Prelude.Maybe Prelude.Text)
subscription_topicArn :: (Maybe Text -> f (Maybe Text)) -> Subscription -> f Subscription
subscription_topicArn = (Subscription -> Maybe Text)
-> (Subscription -> Maybe Text -> Subscription)
-> Lens Subscription Subscription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Maybe Text
topicArn :: Maybe Text
$sel:topicArn:Subscription' :: Subscription -> Maybe Text
topicArn} -> Maybe Text
topicArn) (\s :: Subscription
s@Subscription' {} Maybe Text
a -> Subscription
s {$sel:topicArn:Subscription' :: Maybe Text
topicArn = Maybe Text
a} :: Subscription)
subscription_endpoint :: Lens.Lens' Subscription (Prelude.Maybe Prelude.Text)
subscription_endpoint :: (Maybe Text -> f (Maybe Text)) -> Subscription -> f Subscription
subscription_endpoint = (Subscription -> Maybe Text)
-> (Subscription -> Maybe Text -> Subscription)
-> Lens Subscription Subscription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:Subscription' :: Subscription -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: Subscription
s@Subscription' {} Maybe Text
a -> Subscription
s {$sel:endpoint:Subscription' :: Maybe Text
endpoint = Maybe Text
a} :: Subscription)
subscription_subscriptionArn :: Lens.Lens' Subscription (Prelude.Maybe Prelude.Text)
subscription_subscriptionArn :: (Maybe Text -> f (Maybe Text)) -> Subscription -> f Subscription
subscription_subscriptionArn = (Subscription -> Maybe Text)
-> (Subscription -> Maybe Text -> Subscription)
-> Lens Subscription Subscription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Maybe Text
subscriptionArn :: Maybe Text
$sel:subscriptionArn:Subscription' :: Subscription -> Maybe Text
subscriptionArn} -> Maybe Text
subscriptionArn) (\s :: Subscription
s@Subscription' {} Maybe Text
a -> Subscription
s {$sel:subscriptionArn:Subscription' :: Maybe Text
subscriptionArn = Maybe Text
a} :: Subscription)
instance Core.FromXML Subscription where
parseXML :: [Node] -> Either String Subscription
parseXML [Node]
x =
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Subscription
Subscription'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Subscription)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Subscription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Protocol")
Either
String
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Subscription)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Maybe Text -> Subscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Owner")
Either
String (Maybe Text -> Maybe Text -> Maybe Text -> Subscription)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> Subscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TopicArn")
Either String (Maybe Text -> Maybe Text -> Subscription)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Subscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Endpoint")
Either String (Maybe Text -> Subscription)
-> Either String (Maybe Text) -> Either String Subscription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SubscriptionArn")
instance Prelude.Hashable Subscription
instance Prelude.NFData Subscription