{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data ReportDeliveryChannel = ReportDeliveryChannel'
{
ReportDeliveryChannel -> Maybe [Text]
formats :: Prelude.Maybe [Prelude.Text],
ReportDeliveryChannel -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
ReportDeliveryChannel -> Text
s3BucketName :: Prelude.Text
}
deriving (ReportDeliveryChannel -> ReportDeliveryChannel -> Bool
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]
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
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. 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'
{ $sel:formats:ReportDeliveryChannel' :: Maybe [Text]
formats = forall a. Maybe a
Prelude.Nothing,
$sel:s3KeyPrefix:ReportDeliveryChannel' :: Maybe Text
s3KeyPrefix = forall a. Maybe a
Prelude.Nothing,
$sel:s3BucketName:ReportDeliveryChannel' :: Text
s3BucketName = Text
pS3BucketName_
}
reportDeliveryChannel_formats :: Lens.Lens' ReportDeliveryChannel (Prelude.Maybe [Prelude.Text])
reportDeliveryChannel_formats :: Lens' ReportDeliveryChannel (Maybe [Text])
reportDeliveryChannel_formats = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
reportDeliveryChannel_s3KeyPrefix :: Lens.Lens' ReportDeliveryChannel (Prelude.Maybe Prelude.Text)
reportDeliveryChannel_s3KeyPrefix :: Lens' ReportDeliveryChannel (Maybe Text)
reportDeliveryChannel_s3KeyPrefix = 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_s3BucketName :: Lens.Lens' ReportDeliveryChannel Prelude.Text
reportDeliveryChannel_s3BucketName :: Lens' ReportDeliveryChannel Text
reportDeliveryChannel_s3BucketName = 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 Data.FromJSON ReportDeliveryChannel where
parseJSON :: Value -> Parser ReportDeliveryChannel
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ReportDeliveryChannel"
( \Object
x ->
Maybe [Text] -> Maybe Text -> Text -> ReportDeliveryChannel
ReportDeliveryChannel'
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
"Formats" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3KeyPrefix")
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
"S3BucketName")
)
instance Prelude.Hashable ReportDeliveryChannel where
hashWithSalt :: Int -> ReportDeliveryChannel -> Int
hashWithSalt Int
_salt ReportDeliveryChannel' {Maybe [Text]
Maybe Text
Text
s3BucketName :: Text
s3KeyPrefix :: Maybe Text
formats :: Maybe [Text]
$sel:s3BucketName:ReportDeliveryChannel' :: ReportDeliveryChannel -> Text
$sel:s3KeyPrefix:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe Text
$sel:formats:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
formats
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3KeyPrefix
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3BucketName
instance Prelude.NFData ReportDeliveryChannel where
rnf :: ReportDeliveryChannel -> ()
rnf ReportDeliveryChannel' {Maybe [Text]
Maybe Text
Text
s3BucketName :: Text
s3KeyPrefix :: Maybe Text
formats :: Maybe [Text]
$sel:s3BucketName:ReportDeliveryChannel' :: ReportDeliveryChannel -> Text
$sel:s3KeyPrefix:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe Text
$sel:formats:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
formats
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3KeyPrefix
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3BucketName
instance Data.ToJSON ReportDeliveryChannel where
toJSON :: ReportDeliveryChannel -> Value
toJSON ReportDeliveryChannel' {Maybe [Text]
Maybe Text
Text
s3BucketName :: Text
s3KeyPrefix :: Maybe Text
formats :: Maybe [Text]
$sel:s3BucketName:ReportDeliveryChannel' :: ReportDeliveryChannel -> Text
$sel:s3KeyPrefix:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe Text
$sel:formats:ReportDeliveryChannel' :: ReportDeliveryChannel -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Formats" 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 [Text]
formats,
(Key
"S3KeyPrefix" 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 Text
s3KeyPrefix,
forall a. a -> Maybe a
Prelude.Just (Key
"S3BucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3BucketName)
]
)