{-# 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.Glacier.Types.VaultNotificationConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VaultNotificationConfig = VaultNotificationConfig'
{
VaultNotificationConfig -> Maybe Text
sNSTopic :: Prelude.Maybe Prelude.Text,
VaultNotificationConfig -> Maybe [Text]
events :: Prelude.Maybe [Prelude.Text]
}
deriving (VaultNotificationConfig -> VaultNotificationConfig -> Bool
(VaultNotificationConfig -> VaultNotificationConfig -> Bool)
-> (VaultNotificationConfig -> VaultNotificationConfig -> Bool)
-> Eq VaultNotificationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VaultNotificationConfig -> VaultNotificationConfig -> Bool
$c/= :: VaultNotificationConfig -> VaultNotificationConfig -> Bool
== :: VaultNotificationConfig -> VaultNotificationConfig -> Bool
$c== :: VaultNotificationConfig -> VaultNotificationConfig -> Bool
Prelude.Eq, ReadPrec [VaultNotificationConfig]
ReadPrec VaultNotificationConfig
Int -> ReadS VaultNotificationConfig
ReadS [VaultNotificationConfig]
(Int -> ReadS VaultNotificationConfig)
-> ReadS [VaultNotificationConfig]
-> ReadPrec VaultNotificationConfig
-> ReadPrec [VaultNotificationConfig]
-> Read VaultNotificationConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VaultNotificationConfig]
$creadListPrec :: ReadPrec [VaultNotificationConfig]
readPrec :: ReadPrec VaultNotificationConfig
$creadPrec :: ReadPrec VaultNotificationConfig
readList :: ReadS [VaultNotificationConfig]
$creadList :: ReadS [VaultNotificationConfig]
readsPrec :: Int -> ReadS VaultNotificationConfig
$creadsPrec :: Int -> ReadS VaultNotificationConfig
Prelude.Read, Int -> VaultNotificationConfig -> ShowS
[VaultNotificationConfig] -> ShowS
VaultNotificationConfig -> String
(Int -> VaultNotificationConfig -> ShowS)
-> (VaultNotificationConfig -> String)
-> ([VaultNotificationConfig] -> ShowS)
-> Show VaultNotificationConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VaultNotificationConfig] -> ShowS
$cshowList :: [VaultNotificationConfig] -> ShowS
show :: VaultNotificationConfig -> String
$cshow :: VaultNotificationConfig -> String
showsPrec :: Int -> VaultNotificationConfig -> ShowS
$cshowsPrec :: Int -> VaultNotificationConfig -> ShowS
Prelude.Show, (forall x.
VaultNotificationConfig -> Rep VaultNotificationConfig x)
-> (forall x.
Rep VaultNotificationConfig x -> VaultNotificationConfig)
-> Generic VaultNotificationConfig
forall x. Rep VaultNotificationConfig x -> VaultNotificationConfig
forall x. VaultNotificationConfig -> Rep VaultNotificationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VaultNotificationConfig x -> VaultNotificationConfig
$cfrom :: forall x. VaultNotificationConfig -> Rep VaultNotificationConfig x
Prelude.Generic)
newVaultNotificationConfig ::
VaultNotificationConfig
newVaultNotificationConfig :: VaultNotificationConfig
newVaultNotificationConfig =
VaultNotificationConfig' :: Maybe Text -> Maybe [Text] -> VaultNotificationConfig
VaultNotificationConfig'
{ $sel:sNSTopic:VaultNotificationConfig' :: Maybe Text
sNSTopic =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:events:VaultNotificationConfig' :: Maybe [Text]
events = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
vaultNotificationConfig_sNSTopic :: Lens.Lens' VaultNotificationConfig (Prelude.Maybe Prelude.Text)
vaultNotificationConfig_sNSTopic :: (Maybe Text -> f (Maybe Text))
-> VaultNotificationConfig -> f VaultNotificationConfig
vaultNotificationConfig_sNSTopic = (VaultNotificationConfig -> Maybe Text)
-> (VaultNotificationConfig
-> Maybe Text -> VaultNotificationConfig)
-> Lens
VaultNotificationConfig
VaultNotificationConfig
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VaultNotificationConfig' {Maybe Text
sNSTopic :: Maybe Text
$sel:sNSTopic:VaultNotificationConfig' :: VaultNotificationConfig -> Maybe Text
sNSTopic} -> Maybe Text
sNSTopic) (\s :: VaultNotificationConfig
s@VaultNotificationConfig' {} Maybe Text
a -> VaultNotificationConfig
s {$sel:sNSTopic:VaultNotificationConfig' :: Maybe Text
sNSTopic = Maybe Text
a} :: VaultNotificationConfig)
vaultNotificationConfig_events :: Lens.Lens' VaultNotificationConfig (Prelude.Maybe [Prelude.Text])
vaultNotificationConfig_events :: (Maybe [Text] -> f (Maybe [Text]))
-> VaultNotificationConfig -> f VaultNotificationConfig
vaultNotificationConfig_events = (VaultNotificationConfig -> Maybe [Text])
-> (VaultNotificationConfig
-> Maybe [Text] -> VaultNotificationConfig)
-> Lens
VaultNotificationConfig
VaultNotificationConfig
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VaultNotificationConfig' {Maybe [Text]
events :: Maybe [Text]
$sel:events:VaultNotificationConfig' :: VaultNotificationConfig -> Maybe [Text]
events} -> Maybe [Text]
events) (\s :: VaultNotificationConfig
s@VaultNotificationConfig' {} Maybe [Text]
a -> VaultNotificationConfig
s {$sel:events:VaultNotificationConfig' :: Maybe [Text]
events = Maybe [Text]
a} :: VaultNotificationConfig) ((Maybe [Text] -> f (Maybe [Text]))
-> VaultNotificationConfig -> f VaultNotificationConfig)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VaultNotificationConfig
-> f VaultNotificationConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON VaultNotificationConfig where
parseJSON :: Value -> Parser VaultNotificationConfig
parseJSON =
String
-> (Object -> Parser VaultNotificationConfig)
-> Value
-> Parser VaultNotificationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VaultNotificationConfig"
( \Object
x ->
Maybe Text -> Maybe [Text] -> VaultNotificationConfig
VaultNotificationConfig'
(Maybe Text -> Maybe [Text] -> VaultNotificationConfig)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> VaultNotificationConfig)
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
"SNSTopic")
Parser (Maybe [Text] -> VaultNotificationConfig)
-> Parser (Maybe [Text]) -> Parser VaultNotificationConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Events" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable VaultNotificationConfig
instance Prelude.NFData VaultNotificationConfig
instance Core.ToJSON VaultNotificationConfig where
toJSON :: VaultNotificationConfig -> Value
toJSON VaultNotificationConfig' {Maybe [Text]
Maybe Text
events :: Maybe [Text]
sNSTopic :: Maybe Text
$sel:events:VaultNotificationConfig' :: VaultNotificationConfig -> Maybe [Text]
$sel:sNSTopic:VaultNotificationConfig' :: VaultNotificationConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SNSTopic" 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
sNSTopic,
(Text
"Events" 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]
events
]
)