{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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
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. 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'
{ $sel:advancedBackupSettings:BackupPlan' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings =
forall a. Maybe a
Prelude.Nothing,
$sel:backupPlanName:BackupPlan' :: Text
backupPlanName = Text
pBackupPlanName_,
$sel:rules:BackupPlan' :: [BackupRule]
rules = forall a. Monoid a => a
Prelude.mempty
}
backupPlan_advancedBackupSettings :: Lens.Lens' BackupPlan (Prelude.Maybe [AdvancedBackupSetting])
backupPlan_advancedBackupSettings :: Lens' BackupPlan (Maybe [AdvancedBackupSetting])
backupPlan_advancedBackupSettings = 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) 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
backupPlan_backupPlanName :: Lens.Lens' BackupPlan Prelude.Text
backupPlan_backupPlanName :: Lens' BackupPlan Text
backupPlan_backupPlanName = 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 :: Lens' BackupPlan [BackupRule]
backupPlan_rules = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON BackupPlan where
parseJSON :: Value -> Parser BackupPlan
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"BackupPlan"
( \Object
x ->
Maybe [AdvancedBackupSetting] -> Text -> [BackupRule] -> BackupPlan
BackupPlan'
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
"AdvancedBackupSettings"
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 a
Data..: Key
"BackupPlanName")
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
"Rules" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BackupPlan where
hashWithSalt :: Int -> BackupPlan -> Int
hashWithSalt Int
_salt BackupPlan' {[BackupRule]
Maybe [AdvancedBackupSetting]
Text
rules :: [BackupRule]
backupPlanName :: Text
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:rules:BackupPlan' :: BackupPlan -> [BackupRule]
$sel:backupPlanName:BackupPlan' :: BackupPlan -> Text
$sel:advancedBackupSettings:BackupPlan' :: BackupPlan -> Maybe [AdvancedBackupSetting]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AdvancedBackupSetting]
advancedBackupSettings
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
backupPlanName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [BackupRule]
rules
instance Prelude.NFData BackupPlan where
rnf :: BackupPlan -> ()
rnf BackupPlan' {[BackupRule]
Maybe [AdvancedBackupSetting]
Text
rules :: [BackupRule]
backupPlanName :: Text
advancedBackupSettings :: Maybe [AdvancedBackupSetting]
$sel:rules:BackupPlan' :: BackupPlan -> [BackupRule]
$sel:backupPlanName:BackupPlan' :: BackupPlan -> Text
$sel:advancedBackupSettings:BackupPlan' :: BackupPlan -> Maybe [AdvancedBackupSetting]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [AdvancedBackupSetting]
advancedBackupSettings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
backupPlanName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BackupRule]
rules