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