{-# 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.Config.Types.DeliveryChannel where
import Amazonka.Config.Types.ConfigSnapshotDeliveryProperties
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DeliveryChannel = DeliveryChannel'
{
DeliveryChannel -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
DeliveryChannel -> Maybe Text
snsTopicARN :: Prelude.Maybe Prelude.Text,
DeliveryChannel -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
DeliveryChannel -> Maybe Text
s3KmsKeyArn :: Prelude.Maybe Prelude.Text,
DeliveryChannel -> Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties :: Prelude.Maybe ConfigSnapshotDeliveryProperties,
DeliveryChannel -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text
}
deriving (DeliveryChannel -> DeliveryChannel -> Bool
(DeliveryChannel -> DeliveryChannel -> Bool)
-> (DeliveryChannel -> DeliveryChannel -> Bool)
-> Eq DeliveryChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeliveryChannel -> DeliveryChannel -> Bool
$c/= :: DeliveryChannel -> DeliveryChannel -> Bool
== :: DeliveryChannel -> DeliveryChannel -> Bool
$c== :: DeliveryChannel -> DeliveryChannel -> Bool
Prelude.Eq, ReadPrec [DeliveryChannel]
ReadPrec DeliveryChannel
Int -> ReadS DeliveryChannel
ReadS [DeliveryChannel]
(Int -> ReadS DeliveryChannel)
-> ReadS [DeliveryChannel]
-> ReadPrec DeliveryChannel
-> ReadPrec [DeliveryChannel]
-> Read DeliveryChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeliveryChannel]
$creadListPrec :: ReadPrec [DeliveryChannel]
readPrec :: ReadPrec DeliveryChannel
$creadPrec :: ReadPrec DeliveryChannel
readList :: ReadS [DeliveryChannel]
$creadList :: ReadS [DeliveryChannel]
readsPrec :: Int -> ReadS DeliveryChannel
$creadsPrec :: Int -> ReadS DeliveryChannel
Prelude.Read, Int -> DeliveryChannel -> ShowS
[DeliveryChannel] -> ShowS
DeliveryChannel -> String
(Int -> DeliveryChannel -> ShowS)
-> (DeliveryChannel -> String)
-> ([DeliveryChannel] -> ShowS)
-> Show DeliveryChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeliveryChannel] -> ShowS
$cshowList :: [DeliveryChannel] -> ShowS
show :: DeliveryChannel -> String
$cshow :: DeliveryChannel -> String
showsPrec :: Int -> DeliveryChannel -> ShowS
$cshowsPrec :: Int -> DeliveryChannel -> ShowS
Prelude.Show, (forall x. DeliveryChannel -> Rep DeliveryChannel x)
-> (forall x. Rep DeliveryChannel x -> DeliveryChannel)
-> Generic DeliveryChannel
forall x. Rep DeliveryChannel x -> DeliveryChannel
forall x. DeliveryChannel -> Rep DeliveryChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeliveryChannel x -> DeliveryChannel
$cfrom :: forall x. DeliveryChannel -> Rep DeliveryChannel x
Prelude.Generic)
newDeliveryChannel ::
DeliveryChannel
newDeliveryChannel :: DeliveryChannel
newDeliveryChannel =
DeliveryChannel' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel
DeliveryChannel'
{ $sel:s3KeyPrefix:DeliveryChannel' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:snsTopicARN:DeliveryChannel' :: Maybe Text
snsTopicARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DeliveryChannel' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:s3KmsKeyArn:DeliveryChannel' :: Maybe Text
s3KmsKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:configSnapshotDeliveryProperties:DeliveryChannel' :: Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties = Maybe ConfigSnapshotDeliveryProperties
forall a. Maybe a
Prelude.Nothing,
$sel:s3BucketName:DeliveryChannel' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
deliveryChannel_s3KeyPrefix :: Lens.Lens' DeliveryChannel (Prelude.Maybe Prelude.Text)
deliveryChannel_s3KeyPrefix :: (Maybe Text -> f (Maybe Text))
-> DeliveryChannel -> f DeliveryChannel
deliveryChannel_s3KeyPrefix = (DeliveryChannel -> Maybe Text)
-> (DeliveryChannel -> Maybe Text -> DeliveryChannel)
-> Lens DeliveryChannel DeliveryChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryChannel' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:DeliveryChannel' :: DeliveryChannel -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: DeliveryChannel
s@DeliveryChannel' {} Maybe Text
a -> DeliveryChannel
s {$sel:s3KeyPrefix:DeliveryChannel' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: DeliveryChannel)
deliveryChannel_snsTopicARN :: Lens.Lens' DeliveryChannel (Prelude.Maybe Prelude.Text)
deliveryChannel_snsTopicARN :: (Maybe Text -> f (Maybe Text))
-> DeliveryChannel -> f DeliveryChannel
deliveryChannel_snsTopicARN = (DeliveryChannel -> Maybe Text)
-> (DeliveryChannel -> Maybe Text -> DeliveryChannel)
-> Lens DeliveryChannel DeliveryChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryChannel' {Maybe Text
snsTopicARN :: Maybe Text
$sel:snsTopicARN:DeliveryChannel' :: DeliveryChannel -> Maybe Text
snsTopicARN} -> Maybe Text
snsTopicARN) (\s :: DeliveryChannel
s@DeliveryChannel' {} Maybe Text
a -> DeliveryChannel
s {$sel:snsTopicARN:DeliveryChannel' :: Maybe Text
snsTopicARN = Maybe Text
a} :: DeliveryChannel)
deliveryChannel_name :: Lens.Lens' DeliveryChannel (Prelude.Maybe Prelude.Text)
deliveryChannel_name :: (Maybe Text -> f (Maybe Text))
-> DeliveryChannel -> f DeliveryChannel
deliveryChannel_name = (DeliveryChannel -> Maybe Text)
-> (DeliveryChannel -> Maybe Text -> DeliveryChannel)
-> Lens DeliveryChannel DeliveryChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryChannel' {Maybe Text
name :: Maybe Text
$sel:name:DeliveryChannel' :: DeliveryChannel -> Maybe Text
name} -> Maybe Text
name) (\s :: DeliveryChannel
s@DeliveryChannel' {} Maybe Text
a -> DeliveryChannel
s {$sel:name:DeliveryChannel' :: Maybe Text
name = Maybe Text
a} :: DeliveryChannel)
deliveryChannel_s3KmsKeyArn :: Lens.Lens' DeliveryChannel (Prelude.Maybe Prelude.Text)
deliveryChannel_s3KmsKeyArn :: (Maybe Text -> f (Maybe Text))
-> DeliveryChannel -> f DeliveryChannel
deliveryChannel_s3KmsKeyArn = (DeliveryChannel -> Maybe Text)
-> (DeliveryChannel -> Maybe Text -> DeliveryChannel)
-> Lens DeliveryChannel DeliveryChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryChannel' {Maybe Text
s3KmsKeyArn :: Maybe Text
$sel:s3KmsKeyArn:DeliveryChannel' :: DeliveryChannel -> Maybe Text
s3KmsKeyArn} -> Maybe Text
s3KmsKeyArn) (\s :: DeliveryChannel
s@DeliveryChannel' {} Maybe Text
a -> DeliveryChannel
s {$sel:s3KmsKeyArn:DeliveryChannel' :: Maybe Text
s3KmsKeyArn = Maybe Text
a} :: DeliveryChannel)
deliveryChannel_configSnapshotDeliveryProperties :: Lens.Lens' DeliveryChannel (Prelude.Maybe ConfigSnapshotDeliveryProperties)
deliveryChannel_configSnapshotDeliveryProperties :: (Maybe ConfigSnapshotDeliveryProperties
-> f (Maybe ConfigSnapshotDeliveryProperties))
-> DeliveryChannel -> f DeliveryChannel
deliveryChannel_configSnapshotDeliveryProperties = (DeliveryChannel -> Maybe ConfigSnapshotDeliveryProperties)
-> (DeliveryChannel
-> Maybe ConfigSnapshotDeliveryProperties -> DeliveryChannel)
-> Lens
DeliveryChannel
DeliveryChannel
(Maybe ConfigSnapshotDeliveryProperties)
(Maybe ConfigSnapshotDeliveryProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryChannel' {Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties :: Maybe ConfigSnapshotDeliveryProperties
$sel:configSnapshotDeliveryProperties:DeliveryChannel' :: DeliveryChannel -> Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties} -> Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties) (\s :: DeliveryChannel
s@DeliveryChannel' {} Maybe ConfigSnapshotDeliveryProperties
a -> DeliveryChannel
s {$sel:configSnapshotDeliveryProperties:DeliveryChannel' :: Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties = Maybe ConfigSnapshotDeliveryProperties
a} :: DeliveryChannel)
deliveryChannel_s3BucketName :: Lens.Lens' DeliveryChannel (Prelude.Maybe Prelude.Text)
deliveryChannel_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> DeliveryChannel -> f DeliveryChannel
deliveryChannel_s3BucketName = (DeliveryChannel -> Maybe Text)
-> (DeliveryChannel -> Maybe Text -> DeliveryChannel)
-> Lens DeliveryChannel DeliveryChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeliveryChannel' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:DeliveryChannel' :: DeliveryChannel -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: DeliveryChannel
s@DeliveryChannel' {} Maybe Text
a -> DeliveryChannel
s {$sel:s3BucketName:DeliveryChannel' :: Maybe Text
s3BucketName = Maybe Text
a} :: DeliveryChannel)
instance Core.FromJSON DeliveryChannel where
parseJSON :: Value -> Parser DeliveryChannel
parseJSON =
String
-> (Object -> Parser DeliveryChannel)
-> Value
-> Parser DeliveryChannel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DeliveryChannel"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel
DeliveryChannel'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
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
"s3KeyPrefix")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
forall (f :: * -> *) a b. Applicative f => 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
"snsTopicARN")
Parser
(Maybe Text
-> Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
forall (f :: * -> *) a b. Applicative f => 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
"name")
Parser
(Maybe Text
-> Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text
-> DeliveryChannel)
-> Parser (Maybe Text)
-> Parser
(Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text -> DeliveryChannel)
forall (f :: * -> *) a b. Applicative f => 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
"s3KmsKeyArn")
Parser
(Maybe ConfigSnapshotDeliveryProperties
-> Maybe Text -> DeliveryChannel)
-> Parser (Maybe ConfigSnapshotDeliveryProperties)
-> Parser (Maybe Text -> DeliveryChannel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConfigSnapshotDeliveryProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configSnapshotDeliveryProperties")
Parser (Maybe Text -> DeliveryChannel)
-> Parser (Maybe Text) -> Parser DeliveryChannel
forall (f :: * -> *) a b. Applicative f => 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
"s3BucketName")
)
instance Prelude.Hashable DeliveryChannel
instance Prelude.NFData DeliveryChannel
instance Core.ToJSON DeliveryChannel where
toJSON :: DeliveryChannel -> Value
toJSON DeliveryChannel' {Maybe Text
Maybe ConfigSnapshotDeliveryProperties
s3BucketName :: Maybe Text
configSnapshotDeliveryProperties :: Maybe ConfigSnapshotDeliveryProperties
s3KmsKeyArn :: Maybe Text
name :: Maybe Text
snsTopicARN :: Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3BucketName:DeliveryChannel' :: DeliveryChannel -> Maybe Text
$sel:configSnapshotDeliveryProperties:DeliveryChannel' :: DeliveryChannel -> Maybe ConfigSnapshotDeliveryProperties
$sel:s3KmsKeyArn:DeliveryChannel' :: DeliveryChannel -> Maybe Text
$sel:name:DeliveryChannel' :: DeliveryChannel -> Maybe Text
$sel:snsTopicARN:DeliveryChannel' :: DeliveryChannel -> Maybe Text
$sel:s3KeyPrefix:DeliveryChannel' :: DeliveryChannel -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"s3KeyPrefix" 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
s3KeyPrefix,
(Text
"snsTopicARN" 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
snsTopicARN,
(Text
"name" 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
name,
(Text
"s3KmsKeyArn" 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
s3KmsKeyArn,
(Text
"configSnapshotDeliveryProperties" Text -> ConfigSnapshotDeliveryProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ConfigSnapshotDeliveryProperties -> Pair)
-> Maybe ConfigSnapshotDeliveryProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigSnapshotDeliveryProperties
configSnapshotDeliveryProperties,
(Text
"s3BucketName" 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
s3BucketName
]
)