{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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
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. 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'
{ $sel:advancedBackupSettings:BackupPlanInput' :: Maybe [AdvancedBackupSetting]
advancedBackupSettings =
forall a. Maybe a
Prelude.Nothing,
$sel:backupPlanName:BackupPlanInput' :: Text
backupPlanName = Text
pBackupPlanName_,
$sel:rules:BackupPlanInput' :: [BackupRuleInput]
rules = forall a. Monoid a => a
Prelude.mempty
}
backupPlanInput_advancedBackupSettings :: Lens.Lens' BackupPlanInput (Prelude.Maybe [AdvancedBackupSetting])
backupPlanInput_advancedBackupSettings :: Lens' BackupPlanInput (Maybe [AdvancedBackupSetting])
backupPlanInput_advancedBackupSettings = 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) 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
backupPlanInput_backupPlanName :: Lens.Lens' BackupPlanInput Prelude.Text
backupPlanInput_backupPlanName :: Lens' BackupPlanInput Text
backupPlanInput_backupPlanName = 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 :: Lens' BackupPlanInput [BackupRuleInput]
backupPlanInput_rules = 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) 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 Prelude.Hashable BackupPlanInput where
hashWithSalt :: Int -> BackupPlanInput -> Int
hashWithSalt Int
_salt 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]
..} =
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` [BackupRuleInput]
rules
instance Prelude.NFData BackupPlanInput where
rnf :: BackupPlanInput -> ()
rnf 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]
..} =
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 [BackupRuleInput]
rules
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AdvancedBackupSettings" 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 [AdvancedBackupSetting]
advancedBackupSettings,
forall a. a -> Maybe a
Prelude.Just
(Key
"BackupPlanName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
backupPlanName),
forall a. a -> Maybe a
Prelude.Just (Key
"Rules" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [BackupRuleInput]
rules)
]
)