{-# 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.BackupPlan where
import Amazonka.Backup.Types.AdvancedBackupSetting
import Amazonka.Backup.Types.BackupRule
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BackupPlan = BackupPlan'
{
BackupPlan -> Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Prelude.Maybe [AdvancedBackupSetting],
BackupPlan -> Text
backupPlanName :: Prelude.Text,
BackupPlan -> [BackupRule]
rules :: [BackupRule]
}
deriving (BackupPlan -> BackupPlan -> Bool
(BackupPlan -> BackupPlan -> Bool)
-> (BackupPlan -> BackupPlan -> Bool) -> Eq BackupPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackupPlan -> BackupPlan -> Bool
$c/= :: BackupPlan -> BackupPlan -> Bool
== :: BackupPlan -> BackupPlan -> Bool
$c== :: BackupPlan -> BackupPlan -> Bool
Prelude.Eq, Int -> BackupPlan -> ShowS
[BackupPlan] -> ShowS
BackupPlan -> String
(Int -> BackupPlan -> ShowS)
-> (BackupPlan -> String)
-> ([BackupPlan] -> ShowS)
-> Show BackupPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackupPlan] -> ShowS
$cshowList :: [BackupPlan] -> ShowS
show :: BackupPlan -> String
$cshow :: BackupPlan -> String
showsPrec :: Int -> BackupPlan -> ShowS
$cshowsPrec :: Int -> BackupPlan -> ShowS
Prelude.Show, (forall x. BackupPlan -> Rep BackupPlan x)
-> (forall x. Rep BackupPlan x -> BackupPlan) -> Generic BackupPlan
forall x. Rep BackupPlan x -> BackupPlan
forall x. BackupPlan -> Rep BackupPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackupPlan x -> BackupPlan
$cfrom :: forall x. BackupPlan -> Rep BackupPlan x
Prelude.Generic)
newBackupPlan ::
Prelude.Text ->
BackupPlan
newBackupPlan :: Text -> BackupPlan
newBackupPlan Text
pBackupPlanName_ =
BackupPlan' :: Maybe [AdvancedBackupSetting] -> Text -> [BackupRule] -> BackupPlan
BackupPlan'
{ $sel:advancedBackupSettings:BackupPlan' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings =
Maybe [AdvancedBackupSetting]
forall a. Maybe a
Prelude.Nothing,
$sel:backupPlanName:BackupPlan' :: Text
backupPlanName = Text
pBackupPlanName_,
$sel:rules:BackupPlan' :: [BackupRule]
rules = [BackupRule]
forall a. Monoid a => a
Prelude.mempty
}
backupPlan_advancedBackupSettings :: Lens.Lens' BackupPlan (Prelude.Maybe [AdvancedBackupSetting])
backupPlan_advancedBackupSettings :: (Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> BackupPlan -> f BackupPlan
backupPlan_advancedBackupSettings = (BackupPlan -> Maybe [AdvancedBackupSetting])
-> (BackupPlan -> Maybe [AdvancedBackupSetting] -> BackupPlan)
-> Lens
BackupPlan
BackupPlan
(Maybe [AdvancedBackupSetting])
(Maybe [AdvancedBackupSetting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPlan' {Maybe [AdvancedBackupSetting]
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:advancedBackupSettings:BackupPlan' :: BackupPlan -> Maybe [AdvancedBackupSetting]
advancedBackupSettings} -> Maybe [AdvancedBackupSetting]
advancedBackupSettings) (\s :: BackupPlan
s@BackupPlan' {} Maybe [AdvancedBackupSetting]
a -> BackupPlan
s {$sel:advancedBackupSettings:BackupPlan' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings = Maybe [AdvancedBackupSetting]
a} :: BackupPlan) ((Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> BackupPlan -> f BackupPlan)
-> ((Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> (Maybe [AdvancedBackupSetting]
-> f (Maybe [AdvancedBackupSetting]))
-> BackupPlan
-> f BackupPlan
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
backupPlan_backupPlanName :: Lens.Lens' BackupPlan Prelude.Text
backupPlan_backupPlanName :: (Text -> f Text) -> BackupPlan -> f BackupPlan
backupPlan_backupPlanName = (BackupPlan -> Text)
-> (BackupPlan -> Text -> BackupPlan)
-> Lens BackupPlan BackupPlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPlan' {Text
backupPlanName :: Text
$sel:backupPlanName:BackupPlan' :: BackupPlan -> Text
backupPlanName} -> Text
backupPlanName) (\s :: BackupPlan
s@BackupPlan' {} Text
a -> BackupPlan
s {$sel:backupPlanName:BackupPlan' :: Text
backupPlanName = Text
a} :: BackupPlan)
backupPlan_rules :: Lens.Lens' BackupPlan [BackupRule]
backupPlan_rules :: ([BackupRule] -> f [BackupRule]) -> BackupPlan -> f BackupPlan
backupPlan_rules = (BackupPlan -> [BackupRule])
-> (BackupPlan -> [BackupRule] -> BackupPlan)
-> Lens BackupPlan BackupPlan [BackupRule] [BackupRule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPlan' {[BackupRule]
rules :: [BackupRule]
$sel:rules:BackupPlan' :: BackupPlan -> [BackupRule]
rules} -> [BackupRule]
rules) (\s :: BackupPlan
s@BackupPlan' {} [BackupRule]
a -> BackupPlan
s {$sel:rules:BackupPlan' :: [BackupRule]
rules = [BackupRule]
a} :: BackupPlan) (([BackupRule] -> f [BackupRule]) -> BackupPlan -> f BackupPlan)
-> (([BackupRule] -> f [BackupRule])
-> [BackupRule] -> f [BackupRule])
-> ([BackupRule] -> f [BackupRule])
-> BackupPlan
-> f BackupPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BackupRule] -> f [BackupRule]) -> [BackupRule] -> f [BackupRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON BackupPlan where
parseJSON :: Value -> Parser BackupPlan
parseJSON =
String
-> (Object -> Parser BackupPlan) -> Value -> Parser BackupPlan
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"BackupPlan"
( \Object
x ->
Maybe [AdvancedBackupSetting] -> Text -> [BackupRule] -> BackupPlan
BackupPlan'
(Maybe [AdvancedBackupSetting]
-> Text -> [BackupRule] -> BackupPlan)
-> Parser (Maybe [AdvancedBackupSetting])
-> Parser (Text -> [BackupRule] -> BackupPlan)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AdvancedBackupSetting]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AdvancedBackupSettings"
Parser (Maybe (Maybe [AdvancedBackupSetting]))
-> Maybe [AdvancedBackupSetting]
-> Parser (Maybe [AdvancedBackupSetting])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AdvancedBackupSetting]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Text -> [BackupRule] -> BackupPlan)
-> Parser Text -> Parser ([BackupRule] -> BackupPlan)
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
"BackupPlanName")
Parser ([BackupRule] -> BackupPlan)
-> Parser [BackupRule] -> Parser BackupPlan
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [BackupRule])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rules" Parser (Maybe [BackupRule]) -> [BackupRule] -> Parser [BackupRule]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [BackupRule]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BackupPlan
instance Prelude.NFData BackupPlan