{-# 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.LookoutMetrics.Types.SNSConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutMetrics.Types.SnsFormat
import qualified Amazonka.Prelude as Prelude
data SNSConfiguration = SNSConfiguration'
{
SNSConfiguration -> Maybe SnsFormat
snsFormat :: Prelude.Maybe SnsFormat,
SNSConfiguration -> Text
roleArn :: Prelude.Text,
SNSConfiguration -> Text
snsTopicArn :: Prelude.Text
}
deriving (SNSConfiguration -> SNSConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SNSConfiguration -> SNSConfiguration -> Bool
$c/= :: SNSConfiguration -> SNSConfiguration -> Bool
== :: SNSConfiguration -> SNSConfiguration -> Bool
$c== :: SNSConfiguration -> SNSConfiguration -> Bool
Prelude.Eq, ReadPrec [SNSConfiguration]
ReadPrec SNSConfiguration
Int -> ReadS SNSConfiguration
ReadS [SNSConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SNSConfiguration]
$creadListPrec :: ReadPrec [SNSConfiguration]
readPrec :: ReadPrec SNSConfiguration
$creadPrec :: ReadPrec SNSConfiguration
readList :: ReadS [SNSConfiguration]
$creadList :: ReadS [SNSConfiguration]
readsPrec :: Int -> ReadS SNSConfiguration
$creadsPrec :: Int -> ReadS SNSConfiguration
Prelude.Read, Int -> SNSConfiguration -> ShowS
[SNSConfiguration] -> ShowS
SNSConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SNSConfiguration] -> ShowS
$cshowList :: [SNSConfiguration] -> ShowS
show :: SNSConfiguration -> String
$cshow :: SNSConfiguration -> String
showsPrec :: Int -> SNSConfiguration -> ShowS
$cshowsPrec :: Int -> SNSConfiguration -> ShowS
Prelude.Show, forall x. Rep SNSConfiguration x -> SNSConfiguration
forall x. SNSConfiguration -> Rep SNSConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SNSConfiguration x -> SNSConfiguration
$cfrom :: forall x. SNSConfiguration -> Rep SNSConfiguration x
Prelude.Generic)
newSNSConfiguration ::
Prelude.Text ->
Prelude.Text ->
SNSConfiguration
newSNSConfiguration :: Text -> Text -> SNSConfiguration
newSNSConfiguration Text
pRoleArn_ Text
pSnsTopicArn_ =
SNSConfiguration'
{ $sel:snsFormat:SNSConfiguration' :: Maybe SnsFormat
snsFormat = forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:SNSConfiguration' :: Text
roleArn = Text
pRoleArn_,
$sel:snsTopicArn:SNSConfiguration' :: Text
snsTopicArn = Text
pSnsTopicArn_
}
sNSConfiguration_snsFormat :: Lens.Lens' SNSConfiguration (Prelude.Maybe SnsFormat)
sNSConfiguration_snsFormat :: Lens' SNSConfiguration (Maybe SnsFormat)
sNSConfiguration_snsFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SNSConfiguration' {Maybe SnsFormat
snsFormat :: Maybe SnsFormat
$sel:snsFormat:SNSConfiguration' :: SNSConfiguration -> Maybe SnsFormat
snsFormat} -> Maybe SnsFormat
snsFormat) (\s :: SNSConfiguration
s@SNSConfiguration' {} Maybe SnsFormat
a -> SNSConfiguration
s {$sel:snsFormat:SNSConfiguration' :: Maybe SnsFormat
snsFormat = Maybe SnsFormat
a} :: SNSConfiguration)
sNSConfiguration_roleArn :: Lens.Lens' SNSConfiguration Prelude.Text
sNSConfiguration_roleArn :: Lens' SNSConfiguration Text
sNSConfiguration_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SNSConfiguration' {Text
roleArn :: Text
$sel:roleArn:SNSConfiguration' :: SNSConfiguration -> Text
roleArn} -> Text
roleArn) (\s :: SNSConfiguration
s@SNSConfiguration' {} Text
a -> SNSConfiguration
s {$sel:roleArn:SNSConfiguration' :: Text
roleArn = Text
a} :: SNSConfiguration)
sNSConfiguration_snsTopicArn :: Lens.Lens' SNSConfiguration Prelude.Text
sNSConfiguration_snsTopicArn :: Lens' SNSConfiguration Text
sNSConfiguration_snsTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SNSConfiguration' {Text
snsTopicArn :: Text
$sel:snsTopicArn:SNSConfiguration' :: SNSConfiguration -> Text
snsTopicArn} -> Text
snsTopicArn) (\s :: SNSConfiguration
s@SNSConfiguration' {} Text
a -> SNSConfiguration
s {$sel:snsTopicArn:SNSConfiguration' :: Text
snsTopicArn = Text
a} :: SNSConfiguration)
instance Data.FromJSON SNSConfiguration where
parseJSON :: Value -> Parser SNSConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SNSConfiguration"
( \Object
x ->
Maybe SnsFormat -> Text -> Text -> SNSConfiguration
SNSConfiguration'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SnsFormat")
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
"RoleArn")
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
"SnsTopicArn")
)
instance Prelude.Hashable SNSConfiguration where
hashWithSalt :: Int -> SNSConfiguration -> Int
hashWithSalt Int
_salt SNSConfiguration' {Maybe SnsFormat
Text
snsTopicArn :: Text
roleArn :: Text
snsFormat :: Maybe SnsFormat
$sel:snsTopicArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:roleArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:snsFormat:SNSConfiguration' :: SNSConfiguration -> Maybe SnsFormat
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SnsFormat
snsFormat
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snsTopicArn
instance Prelude.NFData SNSConfiguration where
rnf :: SNSConfiguration -> ()
rnf SNSConfiguration' {Maybe SnsFormat
Text
snsTopicArn :: Text
roleArn :: Text
snsFormat :: Maybe SnsFormat
$sel:snsTopicArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:roleArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:snsFormat:SNSConfiguration' :: SNSConfiguration -> Maybe SnsFormat
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SnsFormat
snsFormat
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snsTopicArn
instance Data.ToJSON SNSConfiguration where
toJSON :: SNSConfiguration -> Value
toJSON SNSConfiguration' {Maybe SnsFormat
Text
snsTopicArn :: Text
roleArn :: Text
snsFormat :: Maybe SnsFormat
$sel:snsTopicArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:roleArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:snsFormat:SNSConfiguration' :: SNSConfiguration -> Maybe SnsFormat
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SnsFormat" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SnsFormat
snsFormat,
forall a. a -> Maybe a
Prelude.Just (Key
"RoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
forall a. a -> Maybe a
Prelude.Just (Key
"SnsTopicArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
snsTopicArn)
]
)