{-# 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.IoTAnalytics.Types.ChannelActivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ChannelActivity = ChannelActivity'
{
ChannelActivity -> Maybe Text
next :: Prelude.Maybe Prelude.Text,
ChannelActivity -> Text
name :: Prelude.Text,
ChannelActivity -> Text
channelName :: Prelude.Text
}
deriving (ChannelActivity -> ChannelActivity -> Bool
(ChannelActivity -> ChannelActivity -> Bool)
-> (ChannelActivity -> ChannelActivity -> Bool)
-> Eq ChannelActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelActivity -> ChannelActivity -> Bool
$c/= :: ChannelActivity -> ChannelActivity -> Bool
== :: ChannelActivity -> ChannelActivity -> Bool
$c== :: ChannelActivity -> ChannelActivity -> Bool
Prelude.Eq, ReadPrec [ChannelActivity]
ReadPrec ChannelActivity
Int -> ReadS ChannelActivity
ReadS [ChannelActivity]
(Int -> ReadS ChannelActivity)
-> ReadS [ChannelActivity]
-> ReadPrec ChannelActivity
-> ReadPrec [ChannelActivity]
-> Read ChannelActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelActivity]
$creadListPrec :: ReadPrec [ChannelActivity]
readPrec :: ReadPrec ChannelActivity
$creadPrec :: ReadPrec ChannelActivity
readList :: ReadS [ChannelActivity]
$creadList :: ReadS [ChannelActivity]
readsPrec :: Int -> ReadS ChannelActivity
$creadsPrec :: Int -> ReadS ChannelActivity
Prelude.Read, Int -> ChannelActivity -> ShowS
[ChannelActivity] -> ShowS
ChannelActivity -> String
(Int -> ChannelActivity -> ShowS)
-> (ChannelActivity -> String)
-> ([ChannelActivity] -> ShowS)
-> Show ChannelActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelActivity] -> ShowS
$cshowList :: [ChannelActivity] -> ShowS
show :: ChannelActivity -> String
$cshow :: ChannelActivity -> String
showsPrec :: Int -> ChannelActivity -> ShowS
$cshowsPrec :: Int -> ChannelActivity -> ShowS
Prelude.Show, (forall x. ChannelActivity -> Rep ChannelActivity x)
-> (forall x. Rep ChannelActivity x -> ChannelActivity)
-> Generic ChannelActivity
forall x. Rep ChannelActivity x -> ChannelActivity
forall x. ChannelActivity -> Rep ChannelActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelActivity x -> ChannelActivity
$cfrom :: forall x. ChannelActivity -> Rep ChannelActivity x
Prelude.Generic)
newChannelActivity ::
Prelude.Text ->
Prelude.Text ->
ChannelActivity
newChannelActivity :: Text -> Text -> ChannelActivity
newChannelActivity Text
pName_ Text
pChannelName_ =
ChannelActivity' :: Maybe Text -> Text -> Text -> ChannelActivity
ChannelActivity'
{ $sel:next:ChannelActivity' :: Maybe Text
next = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:ChannelActivity' :: Text
name = Text
pName_,
$sel:channelName:ChannelActivity' :: Text
channelName = Text
pChannelName_
}
channelActivity_next :: Lens.Lens' ChannelActivity (Prelude.Maybe Prelude.Text)
channelActivity_next :: (Maybe Text -> f (Maybe Text))
-> ChannelActivity -> f ChannelActivity
channelActivity_next = (ChannelActivity -> Maybe Text)
-> (ChannelActivity -> Maybe Text -> ChannelActivity)
-> Lens ChannelActivity ChannelActivity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelActivity' {Maybe Text
next :: Maybe Text
$sel:next:ChannelActivity' :: ChannelActivity -> Maybe Text
next} -> Maybe Text
next) (\s :: ChannelActivity
s@ChannelActivity' {} Maybe Text
a -> ChannelActivity
s {$sel:next:ChannelActivity' :: Maybe Text
next = Maybe Text
a} :: ChannelActivity)
channelActivity_name :: Lens.Lens' ChannelActivity Prelude.Text
channelActivity_name :: (Text -> f Text) -> ChannelActivity -> f ChannelActivity
channelActivity_name = (ChannelActivity -> Text)
-> (ChannelActivity -> Text -> ChannelActivity)
-> Lens ChannelActivity ChannelActivity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelActivity' {Text
name :: Text
$sel:name:ChannelActivity' :: ChannelActivity -> Text
name} -> Text
name) (\s :: ChannelActivity
s@ChannelActivity' {} Text
a -> ChannelActivity
s {$sel:name:ChannelActivity' :: Text
name = Text
a} :: ChannelActivity)
channelActivity_channelName :: Lens.Lens' ChannelActivity Prelude.Text
channelActivity_channelName :: (Text -> f Text) -> ChannelActivity -> f ChannelActivity
channelActivity_channelName = (ChannelActivity -> Text)
-> (ChannelActivity -> Text -> ChannelActivity)
-> Lens ChannelActivity ChannelActivity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelActivity' {Text
channelName :: Text
$sel:channelName:ChannelActivity' :: ChannelActivity -> Text
channelName} -> Text
channelName) (\s :: ChannelActivity
s@ChannelActivity' {} Text
a -> ChannelActivity
s {$sel:channelName:ChannelActivity' :: Text
channelName = Text
a} :: ChannelActivity)
instance Core.FromJSON ChannelActivity where
parseJSON :: Value -> Parser ChannelActivity
parseJSON =
String
-> (Object -> Parser ChannelActivity)
-> Value
-> Parser ChannelActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ChannelActivity"
( \Object
x ->
Maybe Text -> Text -> Text -> ChannelActivity
ChannelActivity'
(Maybe Text -> Text -> Text -> ChannelActivity)
-> Parser (Maybe Text) -> Parser (Text -> Text -> ChannelActivity)
forall (f :: * -> *) a b. Functor 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
"next")
Parser (Text -> Text -> ChannelActivity)
-> Parser Text -> Parser (Text -> ChannelActivity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
Parser (Text -> ChannelActivity)
-> Parser Text -> Parser ChannelActivity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"channelName")
)
instance Prelude.Hashable ChannelActivity
instance Prelude.NFData ChannelActivity
instance Core.ToJSON ChannelActivity where
toJSON :: ChannelActivity -> Value
toJSON ChannelActivity' {Maybe Text
Text
channelName :: Text
name :: Text
next :: Maybe Text
$sel:channelName:ChannelActivity' :: ChannelActivity -> Text
$sel:name:ChannelActivity' :: ChannelActivity -> Text
$sel:next:ChannelActivity' :: ChannelActivity -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"next" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
next,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"channelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
channelName)
]
)