{-# 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.BackupPlanInput where
import Amazonka.Backup.Types.AdvancedBackupSetting
import Amazonka.Backup.Types.BackupRuleInput
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BackupPlanInput = BackupPlanInput'
{
BackupPlanInput -> Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Prelude.Maybe [AdvancedBackupSetting],
BackupPlanInput -> Text
backupPlanName :: Prelude.Text,
BackupPlanInput -> [BackupRuleInput]
rules :: [BackupRuleInput]
}
deriving (BackupPlanInput -> BackupPlanInput -> Bool
(BackupPlanInput -> BackupPlanInput -> Bool)
-> (BackupPlanInput -> BackupPlanInput -> Bool)
-> Eq BackupPlanInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackupPlanInput -> BackupPlanInput -> Bool
$c/= :: BackupPlanInput -> BackupPlanInput -> Bool
== :: BackupPlanInput -> BackupPlanInput -> Bool
$c== :: BackupPlanInput -> BackupPlanInput -> Bool
Prelude.Eq, Int -> BackupPlanInput -> ShowS
[BackupPlanInput] -> ShowS
BackupPlanInput -> String
(Int -> BackupPlanInput -> ShowS)
-> (BackupPlanInput -> String)
-> ([BackupPlanInput] -> ShowS)
-> Show BackupPlanInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackupPlanInput] -> ShowS
$cshowList :: [BackupPlanInput] -> ShowS
show :: BackupPlanInput -> String
$cshow :: BackupPlanInput -> String
showsPrec :: Int -> BackupPlanInput -> ShowS
$cshowsPrec :: Int -> BackupPlanInput -> ShowS
Prelude.Show, (forall x. BackupPlanInput -> Rep BackupPlanInput x)
-> (forall x. Rep BackupPlanInput x -> BackupPlanInput)
-> Generic BackupPlanInput
forall x. Rep BackupPlanInput x -> BackupPlanInput
forall x. BackupPlanInput -> Rep BackupPlanInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackupPlanInput x -> BackupPlanInput
$cfrom :: forall x. BackupPlanInput -> Rep BackupPlanInput x
Prelude.Generic)
newBackupPlanInput ::
Prelude.Text ->
BackupPlanInput
newBackupPlanInput :: Text -> BackupPlanInput
newBackupPlanInput Text
pBackupPlanName_ =
BackupPlanInput' :: Maybe [AdvancedBackupSetting]
-> Text -> [BackupRuleInput] -> BackupPlanInput
BackupPlanInput'
{ $sel:advancedBackupSettings:BackupPlanInput' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings =
Maybe [AdvancedBackupSetting]
forall a. Maybe a
Prelude.Nothing,
$sel:backupPlanName:BackupPlanInput' :: Text
backupPlanName = Text
pBackupPlanName_,
$sel:rules:BackupPlanInput' :: [BackupRuleInput]
rules = [BackupRuleInput]
forall a. Monoid a => a
Prelude.mempty
}
backupPlanInput_advancedBackupSettings :: Lens.Lens' BackupPlanInput (Prelude.Maybe [AdvancedBackupSetting])
backupPlanInput_advancedBackupSettings :: (Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> BackupPlanInput -> f BackupPlanInput
backupPlanInput_advancedBackupSettings = (BackupPlanInput -> Maybe [AdvancedBackupSetting])
-> (BackupPlanInput
-> Maybe [AdvancedBackupSetting] -> BackupPlanInput)
-> Lens
BackupPlanInput
BackupPlanInput
(Maybe [AdvancedBackupSetting])
(Maybe [AdvancedBackupSetting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPlanInput' {Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:advancedBackupSettings:BackupPlanInput' :: BackupPlanInput -> Maybe [AdvancedBackupSetting]
advancedBackupSettings} -> Maybe [AdvancedBackupSetting]
advancedBackupSettings) (\s :: BackupPlanInput
s@BackupPlanInput' {} Maybe [AdvancedBackupSetting]
a -> BackupPlanInput
s {$sel:advancedBackupSettings:BackupPlanInput' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings = Maybe [AdvancedBackupSetting]
a} :: BackupPlanInput) ((Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> BackupPlanInput -> f BackupPlanInput)
-> ((Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> (Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> BackupPlanInput
-> f BackupPlanInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AdvancedBackupSetting]
[AdvancedBackupSetting]
[AdvancedBackupSetting]
[AdvancedBackupSetting]
-> Iso
(Maybe [AdvancedBackupSetting])
(Maybe [AdvancedBackupSetting])
(Maybe [AdvancedBackupSetting])
(Maybe [AdvancedBackupSetting])
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
[AdvancedBackupSetting]
[AdvancedBackupSetting]
[AdvancedBackupSetting]
[AdvancedBackupSetting]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
backupPlanInput_backupPlanName :: Lens.Lens' BackupPlanInput Prelude.Text
backupPlanInput_backupPlanName :: (Text -> f Text) -> BackupPlanInput -> f BackupPlanInput
backupPlanInput_backupPlanName = (BackupPlanInput -> Text)
-> (BackupPlanInput -> Text -> BackupPlanInput)
-> Lens BackupPlanInput BackupPlanInput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPlanInput' {Text
backupPlanName :: Text
$sel:backupPlanName:BackupPlanInput' :: BackupPlanInput -> Text
backupPlanName} -> Text
backupPlanName) (\s :: BackupPlanInput
s@BackupPlanInput' {} Text
a -> BackupPlanInput
s {$sel:backupPlanName:BackupPlanInput' :: Text
backupPlanName = Text
a} :: BackupPlanInput)
backupPlanInput_rules :: Lens.Lens' BackupPlanInput [BackupRuleInput]
backupPlanInput_rules :: ([BackupRuleInput] -> f [BackupRuleInput])
-> BackupPlanInput -> f BackupPlanInput
backupPlanInput_rules = (BackupPlanInput -> [BackupRuleInput])
-> (BackupPlanInput -> [BackupRuleInput] -> BackupPlanInput)
-> Lens
BackupPlanInput BackupPlanInput [BackupRuleInput] [BackupRuleInput]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPlanInput' {[BackupRuleInput]
rules :: [BackupRuleInput]
$sel:rules:BackupPlanInput' :: BackupPlanInput -> [BackupRuleInput]
rules} -> [BackupRuleInput]
rules) (\s :: BackupPlanInput
s@BackupPlanInput' {} [BackupRuleInput]
a -> BackupPlanInput
s {$sel:rules:BackupPlanInput' :: [BackupRuleInput]
rules = [BackupRuleInput]
a} :: BackupPlanInput) (([BackupRuleInput] -> f [BackupRuleInput])
-> BackupPlanInput -> f BackupPlanInput)
-> (([BackupRuleInput] -> f [BackupRuleInput])
-> [BackupRuleInput] -> f [BackupRuleInput])
-> ([BackupRuleInput] -> f [BackupRuleInput])
-> BackupPlanInput
-> f BackupPlanInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BackupRuleInput] -> f [BackupRuleInput])
-> [BackupRuleInput] -> f [BackupRuleInput]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable BackupPlanInput
instance Prelude.NFData BackupPlanInput
instance Core.ToJSON BackupPlanInput where
toJSON :: BackupPlanInput -> Value
toJSON BackupPlanInput' {[BackupRuleInput]
Maybe [AdvancedBackupSetting]
Text
rules :: [BackupRuleInput]
backupPlanName :: Text
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:rules:BackupPlanInput' :: BackupPlanInput -> [BackupRuleInput]
$sel:backupPlanName:BackupPlanInput' :: BackupPlanInput -> Text
$sel:advancedBackupSettings:BackupPlanInput' :: BackupPlanInput -> Maybe [AdvancedBackupSetting]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AdvancedBackupSettings" Text -> [AdvancedBackupSetting] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AdvancedBackupSetting] -> Pair)
-> Maybe [AdvancedBackupSetting] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AdvancedBackupSetting]
advancedBackupSettings,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"BackupPlanName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backupPlanName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Rules" Text -> [BackupRuleInput] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [BackupRuleInput]
rules)
]
)