{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SNSConfiguration = SNSConfiguration'
{
SNSConfiguration -> Text
roleArn :: Prelude.Text,
SNSConfiguration -> Text
snsTopicArn :: Prelude.Text
}
deriving (SNSConfiguration -> SNSConfiguration -> Bool
(SNSConfiguration -> SNSConfiguration -> Bool)
-> (SNSConfiguration -> SNSConfiguration -> Bool)
-> Eq SNSConfiguration
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]
(Int -> ReadS SNSConfiguration)
-> ReadS [SNSConfiguration]
-> ReadPrec SNSConfiguration
-> ReadPrec [SNSConfiguration]
-> Read 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
(Int -> SNSConfiguration -> ShowS)
-> (SNSConfiguration -> String)
-> ([SNSConfiguration] -> ShowS)
-> Show SNSConfiguration
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. SNSConfiguration -> Rep SNSConfiguration x)
-> (forall x. Rep SNSConfiguration x -> SNSConfiguration)
-> Generic SNSConfiguration
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' :: Text -> Text -> SNSConfiguration
SNSConfiguration'
{ $sel:roleArn:SNSConfiguration' :: Text
roleArn = Text
pRoleArn_,
$sel:snsTopicArn:SNSConfiguration' :: Text
snsTopicArn = Text
pSnsTopicArn_
}
sNSConfiguration_roleArn :: Lens.Lens' SNSConfiguration Prelude.Text
sNSConfiguration_roleArn :: (Text -> f Text) -> SNSConfiguration -> f SNSConfiguration
sNSConfiguration_roleArn = (SNSConfiguration -> Text)
-> (SNSConfiguration -> Text -> SNSConfiguration)
-> Lens SNSConfiguration SNSConfiguration Text Text
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 :: (Text -> f Text) -> SNSConfiguration -> f SNSConfiguration
sNSConfiguration_snsTopicArn = (SNSConfiguration -> Text)
-> (SNSConfiguration -> Text -> SNSConfiguration)
-> Lens SNSConfiguration SNSConfiguration Text Text
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 Core.FromJSON SNSConfiguration where
parseJSON :: Value -> Parser SNSConfiguration
parseJSON =
String
-> (Object -> Parser SNSConfiguration)
-> Value
-> Parser SNSConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SNSConfiguration"
( \Object
x ->
Text -> Text -> SNSConfiguration
SNSConfiguration'
(Text -> Text -> SNSConfiguration)
-> Parser Text -> Parser (Text -> SNSConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RoleArn")
Parser (Text -> SNSConfiguration)
-> Parser Text -> Parser SNSConfiguration
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
"SnsTopicArn")
)
instance Prelude.Hashable SNSConfiguration
instance Prelude.NFData SNSConfiguration
instance Core.ToJSON SNSConfiguration where
toJSON :: SNSConfiguration -> Value
toJSON SNSConfiguration' {Text
snsTopicArn :: Text
roleArn :: Text
$sel:snsTopicArn:SNSConfiguration' :: SNSConfiguration -> Text
$sel:roleArn:SNSConfiguration' :: SNSConfiguration -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SnsTopicArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
snsTopicArn)
]
)