{-# 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.Backup.Types.ReportDeliveryChannel where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ReportDeliveryChannel = ReportDeliveryChannel'
{
ReportDeliveryChannel -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
ReportDeliveryChannel -> Maybe [Text]
formats :: Prelude.Maybe [Prelude.Text],
ReportDeliveryChannel -> Text
s3BucketName :: Prelude.Text
}
deriving (ReportDeliveryChannel -> ReportDeliveryChannel -> Bool
(ReportDeliveryChannel -> ReportDeliveryChannel -> Bool)
-> (ReportDeliveryChannel -> ReportDeliveryChannel -> Bool)
-> Eq ReportDeliveryChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportDeliveryChannel -> ReportDeliveryChannel -> Bool
$c/= :: ReportDeliveryChannel -> ReportDeliveryChannel -> Bool
== :: ReportDeliveryChannel -> ReportDeliveryChannel -> Bool
$c== :: ReportDeliveryChannel -> ReportDeliveryChannel -> Bool
Prelude.Eq, ReadPrec [ReportDeliveryChannel]
ReadPrec ReportDeliveryChannel
Int -> ReadS ReportDeliveryChannel
ReadS [ReportDeliveryChannel]
(Int -> ReadS ReportDeliveryChannel)
-> ReadS [ReportDeliveryChannel]
-> ReadPrec ReportDeliveryChannel
-> ReadPrec [ReportDeliveryChannel]
-> Read ReportDeliveryChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportDeliveryChannel]
$creadListPrec :: ReadPrec [ReportDeliveryChannel]
readPrec :: ReadPrec ReportDeliveryChannel
$creadPrec :: ReadPrec ReportDeliveryChannel
readList :: ReadS [ReportDeliveryChannel]
$creadList :: ReadS [ReportDeliveryChannel]
readsPrec :: Int -> ReadS ReportDeliveryChannel
$creadsPrec :: Int -> ReadS ReportDeliveryChannel
Prelude.Read, Int -> ReportDeliveryChannel -> ShowS
[ReportDeliveryChannel] -> ShowS
ReportDeliveryChannel -> String
(Int -> ReportDeliveryChannel -> ShowS)
-> (ReportDeliveryChannel -> String)
-> ([ReportDeliveryChannel] -> ShowS)
-> Show ReportDeliveryChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportDeliveryChannel] -> ShowS
$cshowList :: [ReportDeliveryChannel] -> ShowS
show :: ReportDeliveryChannel -> String
$cshow :: ReportDeliveryChannel -> String
showsPrec :: Int -> ReportDeliveryChannel -> ShowS
$cshowsPrec :: Int -> ReportDeliveryChannel -> ShowS
Prelude.Show, (forall x. ReportDeliveryChannel -> Rep ReportDeliveryChannel x)
-> (forall x. Rep ReportDeliveryChannel x -> ReportDeliveryChannel)
-> Generic ReportDeliveryChannel
forall x. Rep ReportDeliveryChannel x -> ReportDeliveryChannel
forall x. ReportDeliveryChannel -> Rep ReportDeliveryChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportDeliveryChannel x -> ReportDeliveryChannel
$cfrom :: forall x. ReportDeliveryChannel -> Rep ReportDeliveryChannel x
Prelude.Generic)
newReportDeliveryChannel ::
Prelude.Text ->
ReportDeliveryChannel
newReportDeliveryChannel :: Text -> ReportDeliveryChannel
newReportDeliveryChannel Text
pS3BucketName_ =
ReportDeliveryChannel' :: Maybe Text -> Maybe [Text] -> Text -> ReportDeliveryChannel
ReportDeliveryChannel'
{ $sel:s3KeyPrefix:ReportDeliveryChannel' :: Maybe Text
s3KeyPrefix =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:formats:ReportDeliveryChannel' :: Maybe [Text]
formats = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:s3BucketName:ReportDeliveryChannel' :: Text
s3BucketName = Text
pS3BucketName_
}
reportDeliveryChannel_s3KeyPrefix :: Lens.Lens' ReportDeliveryChannel (Prelude.Maybe Prelude.Text)
reportDeliveryChannel_s3KeyPrefix :: (Maybe Text -> f (Maybe Text))
-> ReportDeliveryChannel -> f ReportDeliveryChannel
reportDeliveryChannel_s3KeyPrefix = (ReportDeliveryChannel -> Maybe Text)
-> (ReportDeliveryChannel -> Maybe Text -> ReportDeliveryChannel)
-> Lens
ReportDeliveryChannel
ReportDeliveryChannel
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDeliveryChannel' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: ReportDeliveryChannel
s@ReportDeliveryChannel' {} Maybe Text
a -> ReportDeliveryChannel
s {$sel:s3KeyPrefix:ReportDeliveryChannel' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: ReportDeliveryChannel)
reportDeliveryChannel_formats :: Lens.Lens' ReportDeliveryChannel (Prelude.Maybe [Prelude.Text])
reportDeliveryChannel_formats :: (Maybe [Text] -> f (Maybe [Text]))
-> ReportDeliveryChannel -> f ReportDeliveryChannel
reportDeliveryChannel_formats = (ReportDeliveryChannel -> Maybe [Text])
-> (ReportDeliveryChannel -> Maybe [Text] -> ReportDeliveryChannel)
-> Lens
ReportDeliveryChannel
ReportDeliveryChannel
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDeliveryChannel' {Maybe [Text]
formats :: Maybe [Text]
$sel:formats:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe [Text]
formats} -> Maybe [Text]
formats) (\s :: ReportDeliveryChannel
s@ReportDeliveryChannel' {} Maybe [Text]
a -> ReportDeliveryChannel
s {$sel:formats:ReportDeliveryChannel' :: Maybe [Text]
formats = Maybe [Text]
a} :: ReportDeliveryChannel) ((Maybe [Text] -> f (Maybe [Text]))
-> ReportDeliveryChannel -> f ReportDeliveryChannel)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ReportDeliveryChannel
-> f ReportDeliveryChannel
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
reportDeliveryChannel_s3BucketName :: Lens.Lens' ReportDeliveryChannel Prelude.Text
reportDeliveryChannel_s3BucketName :: (Text -> f Text)
-> ReportDeliveryChannel -> f ReportDeliveryChannel
reportDeliveryChannel_s3BucketName = (ReportDeliveryChannel -> Text)
-> (ReportDeliveryChannel -> Text -> ReportDeliveryChannel)
-> Lens ReportDeliveryChannel ReportDeliveryChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDeliveryChannel' {Text
s3BucketName :: Text
$sel:s3BucketName:ReportDeliveryChannel' :: ReportDeliveryChannel -> Text
s3BucketName} -> Text
s3BucketName) (\s :: ReportDeliveryChannel
s@ReportDeliveryChannel' {} Text
a -> ReportDeliveryChannel
s {$sel:s3BucketName:ReportDeliveryChannel' :: Text
s3BucketName = Text
a} :: ReportDeliveryChannel)
instance Core.FromJSON ReportDeliveryChannel where
parseJSON :: Value -> Parser ReportDeliveryChannel
parseJSON =
String
-> (Object -> Parser ReportDeliveryChannel)
-> Value
-> Parser ReportDeliveryChannel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ReportDeliveryChannel"
( \Object
x ->
Maybe Text -> Maybe [Text] -> Text -> ReportDeliveryChannel
ReportDeliveryChannel'
(Maybe Text -> Maybe [Text] -> Text -> ReportDeliveryChannel)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> Text -> ReportDeliveryChannel)
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] -> Text -> ReportDeliveryChannel)
-> Parser (Maybe [Text]) -> Parser (Text -> ReportDeliveryChannel)
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
"Formats" 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)
Parser (Text -> ReportDeliveryChannel)
-> Parser Text -> Parser ReportDeliveryChannel
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
"S3BucketName")
)
instance Prelude.Hashable ReportDeliveryChannel
instance Prelude.NFData ReportDeliveryChannel
instance Core.ToJSON ReportDeliveryChannel where
toJSON :: ReportDeliveryChannel -> Value
toJSON ReportDeliveryChannel' {Maybe [Text]
Maybe Text
Text
s3BucketName :: Text
formats :: Maybe [Text]
s3KeyPrefix :: Maybe Text
$sel:s3BucketName:ReportDeliveryChannel' :: ReportDeliveryChannel -> Text
$sel:formats:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe [Text]
$sel:s3KeyPrefix:ReportDeliveryChannel' :: ReportDeliveryChannel -> 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
"Formats" 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]
formats,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3BucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3BucketName)
]
)