{-# 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.Greengrass.Types.Subscription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Subscription = Subscription'
{
Subscription -> Text
target :: Prelude.Text,
Subscription -> Text
id :: Prelude.Text,
Subscription -> Text
subject :: Prelude.Text,
Subscription -> Text
source :: Prelude.Text
}
deriving (Subscription -> Subscription -> Bool
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]
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
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. 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 ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Subscription
newSubscription :: Text -> Text -> Text -> Text -> Subscription
newSubscription Text
pTarget_ Text
pId_ Text
pSubject_ Text
pSource_ =
Subscription'
{ $sel:target:Subscription' :: Text
target = Text
pTarget_,
$sel:id:Subscription' :: Text
id = Text
pId_,
$sel:subject:Subscription' :: Text
subject = Text
pSubject_,
$sel:source:Subscription' :: Text
source = Text
pSource_
}
subscription_target :: Lens.Lens' Subscription Prelude.Text
subscription_target :: Lens' Subscription Text
subscription_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Text
target :: Text
$sel:target:Subscription' :: Subscription -> Text
target} -> Text
target) (\s :: Subscription
s@Subscription' {} Text
a -> Subscription
s {$sel:target:Subscription' :: Text
target = Text
a} :: Subscription)
subscription_id :: Lens.Lens' Subscription Prelude.Text
subscription_id :: Lens' Subscription Text
subscription_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Text
id :: Text
$sel:id:Subscription' :: Subscription -> Text
id} -> Text
id) (\s :: Subscription
s@Subscription' {} Text
a -> Subscription
s {$sel:id:Subscription' :: Text
id = Text
a} :: Subscription)
subscription_subject :: Lens.Lens' Subscription Prelude.Text
subscription_subject :: Lens' Subscription Text
subscription_subject = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Text
subject :: Text
$sel:subject:Subscription' :: Subscription -> Text
subject} -> Text
subject) (\s :: Subscription
s@Subscription' {} Text
a -> Subscription
s {$sel:subject:Subscription' :: Text
subject = Text
a} :: Subscription)
subscription_source :: Lens.Lens' Subscription Prelude.Text
subscription_source :: Lens' Subscription Text
subscription_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Text
source :: Text
$sel:source:Subscription' :: Subscription -> Text
source} -> Text
source) (\s :: Subscription
s@Subscription' {} Text
a -> Subscription
s {$sel:source:Subscription' :: Text
source = Text
a} :: Subscription)
instance Data.FromJSON Subscription where
parseJSON :: Value -> Parser Subscription
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Subscription"
( \Object
x ->
Text -> Text -> Text -> Text -> Subscription
Subscription'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Target")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Subject")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Source")
)
instance Prelude.Hashable Subscription where
hashWithSalt :: Int -> Subscription -> Int
hashWithSalt Int
_salt Subscription' {Text
source :: Text
subject :: Text
id :: Text
target :: Text
$sel:source:Subscription' :: Subscription -> Text
$sel:subject:Subscription' :: Subscription -> Text
$sel:id:Subscription' :: Subscription -> Text
$sel:target:Subscription' :: Subscription -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
target
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
subject
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
source
instance Prelude.NFData Subscription where
rnf :: Subscription -> ()
rnf Subscription' {Text
source :: Text
subject :: Text
id :: Text
target :: Text
$sel:source:Subscription' :: Subscription -> Text
$sel:subject:Subscription' :: Subscription -> Text
$sel:id:Subscription' :: Subscription -> Text
$sel:target:Subscription' :: Subscription -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
target
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
subject
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
source
instance Data.ToJSON Subscription where
toJSON :: Subscription -> Value
toJSON Subscription' {Text
source :: Text
subject :: Text
id :: Text
target :: Text
$sel:source:Subscription' :: Subscription -> Text
$sel:subject:Subscription' :: Subscription -> Text
$sel:id:Subscription' :: Subscription -> Text
$sel:target:Subscription' :: Subscription -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Target" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
target),
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id),
forall a. a -> Maybe a
Prelude.Just (Key
"Subject" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
subject),
forall a. a -> Maybe a
Prelude.Just (Key
"Source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
source)
]
)