{-# 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.SSMIncidents.Types.ChatChannel where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.Types.EmptyChatChannel
data ChatChannel = ChatChannel'
{
ChatChannel -> Maybe EmptyChatChannel
empty :: Prelude.Maybe EmptyChatChannel,
ChatChannel -> Maybe (NonEmpty Text)
chatbotSns :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
}
deriving (ChatChannel -> ChatChannel -> Bool
(ChatChannel -> ChatChannel -> Bool)
-> (ChatChannel -> ChatChannel -> Bool) -> Eq ChatChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChatChannel -> ChatChannel -> Bool
$c/= :: ChatChannel -> ChatChannel -> Bool
== :: ChatChannel -> ChatChannel -> Bool
$c== :: ChatChannel -> ChatChannel -> Bool
Prelude.Eq, ReadPrec [ChatChannel]
ReadPrec ChatChannel
Int -> ReadS ChatChannel
ReadS [ChatChannel]
(Int -> ReadS ChatChannel)
-> ReadS [ChatChannel]
-> ReadPrec ChatChannel
-> ReadPrec [ChatChannel]
-> Read ChatChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChatChannel]
$creadListPrec :: ReadPrec [ChatChannel]
readPrec :: ReadPrec ChatChannel
$creadPrec :: ReadPrec ChatChannel
readList :: ReadS [ChatChannel]
$creadList :: ReadS [ChatChannel]
readsPrec :: Int -> ReadS ChatChannel
$creadsPrec :: Int -> ReadS ChatChannel
Prelude.Read, Int -> ChatChannel -> ShowS
[ChatChannel] -> ShowS
ChatChannel -> String
(Int -> ChatChannel -> ShowS)
-> (ChatChannel -> String)
-> ([ChatChannel] -> ShowS)
-> Show ChatChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChatChannel] -> ShowS
$cshowList :: [ChatChannel] -> ShowS
show :: ChatChannel -> String
$cshow :: ChatChannel -> String
showsPrec :: Int -> ChatChannel -> ShowS
$cshowsPrec :: Int -> ChatChannel -> ShowS
Prelude.Show, (forall x. ChatChannel -> Rep ChatChannel x)
-> (forall x. Rep ChatChannel x -> ChatChannel)
-> Generic ChatChannel
forall x. Rep ChatChannel x -> ChatChannel
forall x. ChatChannel -> Rep ChatChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChatChannel x -> ChatChannel
$cfrom :: forall x. ChatChannel -> Rep ChatChannel x
Prelude.Generic)
newChatChannel ::
ChatChannel
newChatChannel :: ChatChannel
newChatChannel =
ChatChannel' :: Maybe EmptyChatChannel -> Maybe (NonEmpty Text) -> ChatChannel
ChatChannel'
{ $sel:empty:ChatChannel' :: Maybe EmptyChatChannel
empty = Maybe EmptyChatChannel
forall a. Maybe a
Prelude.Nothing,
$sel:chatbotSns:ChatChannel' :: Maybe (NonEmpty Text)
chatbotSns = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing
}
chatChannel_empty :: Lens.Lens' ChatChannel (Prelude.Maybe EmptyChatChannel)
chatChannel_empty :: (Maybe EmptyChatChannel -> f (Maybe EmptyChatChannel))
-> ChatChannel -> f ChatChannel
chatChannel_empty = (ChatChannel -> Maybe EmptyChatChannel)
-> (ChatChannel -> Maybe EmptyChatChannel -> ChatChannel)
-> Lens
ChatChannel
ChatChannel
(Maybe EmptyChatChannel)
(Maybe EmptyChatChannel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChatChannel' {Maybe EmptyChatChannel
empty :: Maybe EmptyChatChannel
$sel:empty:ChatChannel' :: ChatChannel -> Maybe EmptyChatChannel
empty} -> Maybe EmptyChatChannel
empty) (\s :: ChatChannel
s@ChatChannel' {} Maybe EmptyChatChannel
a -> ChatChannel
s {$sel:empty:ChatChannel' :: Maybe EmptyChatChannel
empty = Maybe EmptyChatChannel
a} :: ChatChannel)
chatChannel_chatbotSns :: Lens.Lens' ChatChannel (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
chatChannel_chatbotSns :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ChatChannel -> f ChatChannel
chatChannel_chatbotSns = (ChatChannel -> Maybe (NonEmpty Text))
-> (ChatChannel -> Maybe (NonEmpty Text) -> ChatChannel)
-> Lens
ChatChannel
ChatChannel
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChatChannel' {Maybe (NonEmpty Text)
chatbotSns :: Maybe (NonEmpty Text)
$sel:chatbotSns:ChatChannel' :: ChatChannel -> Maybe (NonEmpty Text)
chatbotSns} -> Maybe (NonEmpty Text)
chatbotSns) (\s :: ChatChannel
s@ChatChannel' {} Maybe (NonEmpty Text)
a -> ChatChannel
s {$sel:chatbotSns:ChatChannel' :: Maybe (NonEmpty Text)
chatbotSns = Maybe (NonEmpty Text)
a} :: ChatChannel) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ChatChannel -> f ChatChannel)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ChatChannel
-> f ChatChannel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ChatChannel where
parseJSON :: Value -> Parser ChatChannel
parseJSON =
String
-> (Object -> Parser ChatChannel) -> Value -> Parser ChatChannel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ChatChannel"
( \Object
x ->
Maybe EmptyChatChannel -> Maybe (NonEmpty Text) -> ChatChannel
ChatChannel'
(Maybe EmptyChatChannel -> Maybe (NonEmpty Text) -> ChatChannel)
-> Parser (Maybe EmptyChatChannel)
-> Parser (Maybe (NonEmpty Text) -> ChatChannel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EmptyChatChannel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"empty")
Parser (Maybe (NonEmpty Text) -> ChatChannel)
-> Parser (Maybe (NonEmpty Text)) -> Parser ChatChannel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"chatbotSns")
)
instance Prelude.Hashable ChatChannel
instance Prelude.NFData ChatChannel
instance Core.ToJSON ChatChannel where
toJSON :: ChatChannel -> Value
toJSON ChatChannel' {Maybe (NonEmpty Text)
Maybe EmptyChatChannel
chatbotSns :: Maybe (NonEmpty Text)
empty :: Maybe EmptyChatChannel
$sel:chatbotSns:ChatChannel' :: ChatChannel -> Maybe (NonEmpty Text)
$sel:empty:ChatChannel' :: ChatChannel -> Maybe EmptyChatChannel
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"empty" Text -> EmptyChatChannel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EmptyChatChannel -> Pair) -> Maybe EmptyChatChannel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EmptyChatChannel
empty,
(Text
"chatbotSns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
chatbotSns
]
)