{-# 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.WorkDocs.Types.Subscription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkDocs.Types.SubscriptionProtocolType
data Subscription = Subscription'
{
Subscription -> Maybe SubscriptionProtocolType
protocol :: Prelude.Maybe SubscriptionProtocolType,
Subscription -> Maybe Text
endPoint :: Prelude.Maybe Prelude.Text,
Subscription -> Maybe Text
subscriptionId :: 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 SubscriptionProtocolType
-> Maybe Text -> Maybe Text -> Subscription
Subscription'
{ $sel:protocol:Subscription' :: Maybe SubscriptionProtocolType
protocol = Maybe SubscriptionProtocolType
forall a. Maybe a
Prelude.Nothing,
$sel:endPoint:Subscription' :: Maybe Text
endPoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:subscriptionId:Subscription' :: Maybe Text
subscriptionId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
subscription_protocol :: Lens.Lens' Subscription (Prelude.Maybe SubscriptionProtocolType)
subscription_protocol :: (Maybe SubscriptionProtocolType
-> f (Maybe SubscriptionProtocolType))
-> Subscription -> f Subscription
subscription_protocol = (Subscription -> Maybe SubscriptionProtocolType)
-> (Subscription -> Maybe SubscriptionProtocolType -> Subscription)
-> Lens
Subscription
Subscription
(Maybe SubscriptionProtocolType)
(Maybe SubscriptionProtocolType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Maybe SubscriptionProtocolType
protocol :: Maybe SubscriptionProtocolType
$sel:protocol:Subscription' :: Subscription -> Maybe SubscriptionProtocolType
protocol} -> Maybe SubscriptionProtocolType
protocol) (\s :: Subscription
s@Subscription' {} Maybe SubscriptionProtocolType
a -> Subscription
s {$sel:protocol:Subscription' :: Maybe SubscriptionProtocolType
protocol = Maybe SubscriptionProtocolType
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_subscriptionId :: Lens.Lens' Subscription (Prelude.Maybe Prelude.Text)
subscription_subscriptionId :: (Maybe Text -> f (Maybe Text)) -> Subscription -> f Subscription
subscription_subscriptionId = (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
subscriptionId :: Maybe Text
$sel:subscriptionId:Subscription' :: Subscription -> Maybe Text
subscriptionId} -> Maybe Text
subscriptionId) (\s :: Subscription
s@Subscription' {} Maybe Text
a -> Subscription
s {$sel:subscriptionId:Subscription' :: Maybe Text
subscriptionId = Maybe Text
a} :: Subscription)
instance Core.FromJSON Subscription where
parseJSON :: Value -> Parser Subscription
parseJSON =
String
-> (Object -> Parser Subscription) -> Value -> Parser Subscription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Subscription"
( \Object
x ->
Maybe SubscriptionProtocolType
-> Maybe Text -> Maybe Text -> Subscription
Subscription'
(Maybe SubscriptionProtocolType
-> Maybe Text -> Maybe Text -> Subscription)
-> Parser (Maybe SubscriptionProtocolType)
-> Parser (Maybe Text -> Maybe Text -> Subscription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SubscriptionProtocolType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Protocol")
Parser (Maybe Text -> Maybe Text -> Subscription)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Subscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndPoint")
Parser (Maybe Text -> Subscription)
-> Parser (Maybe Text) -> Parser Subscription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubscriptionId")
)
instance Prelude.Hashable Subscription
instance Prelude.NFData Subscription