{-# 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.BackupSelection where
import Amazonka.Backup.Types.Condition
import Amazonka.Backup.Types.Conditions
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 BackupSelection = BackupSelection'
{
BackupSelection -> Maybe Conditions
conditions :: Prelude.Maybe Conditions,
BackupSelection -> Maybe [Condition]
listOfTags :: Prelude.Maybe [Condition],
BackupSelection -> Maybe [Text]
notResources :: Prelude.Maybe [Prelude.Text],
BackupSelection -> Maybe [Text]
resources :: Prelude.Maybe [Prelude.Text],
BackupSelection -> Text
selectionName :: Prelude.Text,
BackupSelection -> Text
iamRoleArn :: Prelude.Text
}
deriving (BackupSelection -> BackupSelection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackupSelection -> BackupSelection -> Bool
$c/= :: BackupSelection -> BackupSelection -> Bool
== :: BackupSelection -> BackupSelection -> Bool
$c== :: BackupSelection -> BackupSelection -> Bool
Prelude.Eq, ReadPrec [BackupSelection]
ReadPrec BackupSelection
Int -> ReadS BackupSelection
ReadS [BackupSelection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackupSelection]
$creadListPrec :: ReadPrec [BackupSelection]
readPrec :: ReadPrec BackupSelection
$creadPrec :: ReadPrec BackupSelection
readList :: ReadS [BackupSelection]
$creadList :: ReadS [BackupSelection]
readsPrec :: Int -> ReadS BackupSelection
$creadsPrec :: Int -> ReadS BackupSelection
Prelude.Read, Int -> BackupSelection -> ShowS
[BackupSelection] -> ShowS
BackupSelection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackupSelection] -> ShowS
$cshowList :: [BackupSelection] -> ShowS
show :: BackupSelection -> String
$cshow :: BackupSelection -> String
showsPrec :: Int -> BackupSelection -> ShowS
$cshowsPrec :: Int -> BackupSelection -> ShowS
Prelude.Show, forall x. Rep BackupSelection x -> BackupSelection
forall x. BackupSelection -> Rep BackupSelection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackupSelection x -> BackupSelection
$cfrom :: forall x. BackupSelection -> Rep BackupSelection x
Prelude.Generic)
newBackupSelection ::
Prelude.Text ->
Prelude.Text ->
BackupSelection
newBackupSelection :: Text -> Text -> BackupSelection
newBackupSelection Text
pSelectionName_ Text
pIamRoleArn_ =
BackupSelection'
{ $sel:conditions:BackupSelection' :: Maybe Conditions
conditions = forall a. Maybe a
Prelude.Nothing,
$sel:listOfTags:BackupSelection' :: Maybe [Condition]
listOfTags = forall a. Maybe a
Prelude.Nothing,
$sel:notResources:BackupSelection' :: Maybe [Text]
notResources = forall a. Maybe a
Prelude.Nothing,
$sel:resources:BackupSelection' :: Maybe [Text]
resources = forall a. Maybe a
Prelude.Nothing,
$sel:selectionName:BackupSelection' :: Text
selectionName = Text
pSelectionName_,
$sel:iamRoleArn:BackupSelection' :: Text
iamRoleArn = Text
pIamRoleArn_
}
backupSelection_conditions :: Lens.Lens' BackupSelection (Prelude.Maybe Conditions)
backupSelection_conditions :: Lens' BackupSelection (Maybe Conditions)
backupSelection_conditions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupSelection' {Maybe Conditions
conditions :: Maybe Conditions
$sel:conditions:BackupSelection' :: BackupSelection -> Maybe Conditions
conditions} -> Maybe Conditions
conditions) (\s :: BackupSelection
s@BackupSelection' {} Maybe Conditions
a -> BackupSelection
s {$sel:conditions:BackupSelection' :: Maybe Conditions
conditions = Maybe Conditions
a} :: BackupSelection)
backupSelection_listOfTags :: Lens.Lens' BackupSelection (Prelude.Maybe [Condition])
backupSelection_listOfTags :: Lens' BackupSelection (Maybe [Condition])
backupSelection_listOfTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupSelection' {Maybe [Condition]
listOfTags :: Maybe [Condition]
$sel:listOfTags:BackupSelection' :: BackupSelection -> Maybe [Condition]
listOfTags} -> Maybe [Condition]
listOfTags) (\s :: BackupSelection
s@BackupSelection' {} Maybe [Condition]
a -> BackupSelection
s {$sel:listOfTags:BackupSelection' :: Maybe [Condition]
listOfTags = Maybe [Condition]
a} :: BackupSelection) 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
backupSelection_notResources :: Lens.Lens' BackupSelection (Prelude.Maybe [Prelude.Text])
backupSelection_notResources :: Lens' BackupSelection (Maybe [Text])
backupSelection_notResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupSelection' {Maybe [Text]
notResources :: Maybe [Text]
$sel:notResources:BackupSelection' :: BackupSelection -> Maybe [Text]
notResources} -> Maybe [Text]
notResources) (\s :: BackupSelection
s@BackupSelection' {} Maybe [Text]
a -> BackupSelection
s {$sel:notResources:BackupSelection' :: Maybe [Text]
notResources = Maybe [Text]
a} :: BackupSelection) 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
backupSelection_resources :: Lens.Lens' BackupSelection (Prelude.Maybe [Prelude.Text])
backupSelection_resources :: Lens' BackupSelection (Maybe [Text])
backupSelection_resources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupSelection' {Maybe [Text]
resources :: Maybe [Text]
$sel:resources:BackupSelection' :: BackupSelection -> Maybe [Text]
resources} -> Maybe [Text]
resources) (\s :: BackupSelection
s@BackupSelection' {} Maybe [Text]
a -> BackupSelection
s {$sel:resources:BackupSelection' :: Maybe [Text]
resources = Maybe [Text]
a} :: BackupSelection) 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
backupSelection_selectionName :: Lens.Lens' BackupSelection Prelude.Text
backupSelection_selectionName :: Lens' BackupSelection Text
backupSelection_selectionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupSelection' {Text
selectionName :: Text
$sel:selectionName:BackupSelection' :: BackupSelection -> Text
selectionName} -> Text
selectionName) (\s :: BackupSelection
s@BackupSelection' {} Text
a -> BackupSelection
s {$sel:selectionName:BackupSelection' :: Text
selectionName = Text
a} :: BackupSelection)
backupSelection_iamRoleArn :: Lens.Lens' BackupSelection Prelude.Text
backupSelection_iamRoleArn :: Lens' BackupSelection Text
backupSelection_iamRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupSelection' {Text
iamRoleArn :: Text
$sel:iamRoleArn:BackupSelection' :: BackupSelection -> Text
iamRoleArn} -> Text
iamRoleArn) (\s :: BackupSelection
s@BackupSelection' {} Text
a -> BackupSelection
s {$sel:iamRoleArn:BackupSelection' :: Text
iamRoleArn = Text
a} :: BackupSelection)
instance Data.FromJSON BackupSelection where
parseJSON :: Value -> Parser BackupSelection
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"BackupSelection"
( \Object
x ->
Maybe Conditions
-> Maybe [Condition]
-> Maybe [Text]
-> Maybe [Text]
-> Text
-> Text
-> BackupSelection
BackupSelection'
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
"Conditions")
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
"ListOfTags" 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
"NotResources" 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
"Resources" 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
"SelectionName")
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
"IamRoleArn")
)
instance Prelude.Hashable BackupSelection where
hashWithSalt :: Int -> BackupSelection -> Int
hashWithSalt Int
_salt BackupSelection' {Maybe [Text]
Maybe [Condition]
Maybe Conditions
Text
iamRoleArn :: Text
selectionName :: Text
resources :: Maybe [Text]
notResources :: Maybe [Text]
listOfTags :: Maybe [Condition]
conditions :: Maybe Conditions
$sel:iamRoleArn:BackupSelection' :: BackupSelection -> Text
$sel:selectionName:BackupSelection' :: BackupSelection -> Text
$sel:resources:BackupSelection' :: BackupSelection -> Maybe [Text]
$sel:notResources:BackupSelection' :: BackupSelection -> Maybe [Text]
$sel:listOfTags:BackupSelection' :: BackupSelection -> Maybe [Condition]
$sel:conditions:BackupSelection' :: BackupSelection -> Maybe Conditions
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Conditions
conditions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Condition]
listOfTags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
notResources
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
resources
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
selectionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
iamRoleArn
instance Prelude.NFData BackupSelection where
rnf :: BackupSelection -> ()
rnf BackupSelection' {Maybe [Text]
Maybe [Condition]
Maybe Conditions
Text
iamRoleArn :: Text
selectionName :: Text
resources :: Maybe [Text]
notResources :: Maybe [Text]
listOfTags :: Maybe [Condition]
conditions :: Maybe Conditions
$sel:iamRoleArn:BackupSelection' :: BackupSelection -> Text
$sel:selectionName:BackupSelection' :: BackupSelection -> Text
$sel:resources:BackupSelection' :: BackupSelection -> Maybe [Text]
$sel:notResources:BackupSelection' :: BackupSelection -> Maybe [Text]
$sel:listOfTags:BackupSelection' :: BackupSelection -> Maybe [Condition]
$sel:conditions:BackupSelection' :: BackupSelection -> Maybe Conditions
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Conditions
conditions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Condition]
listOfTags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
notResources
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resources
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
selectionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
iamRoleArn
instance Data.ToJSON BackupSelection where
toJSON :: BackupSelection -> Value
toJSON BackupSelection' {Maybe [Text]
Maybe [Condition]
Maybe Conditions
Text
iamRoleArn :: Text
selectionName :: Text
resources :: Maybe [Text]
notResources :: Maybe [Text]
listOfTags :: Maybe [Condition]
conditions :: Maybe Conditions
$sel:iamRoleArn:BackupSelection' :: BackupSelection -> Text
$sel:selectionName:BackupSelection' :: BackupSelection -> Text
$sel:resources:BackupSelection' :: BackupSelection -> Maybe [Text]
$sel:notResources:BackupSelection' :: BackupSelection -> Maybe [Text]
$sel:listOfTags:BackupSelection' :: BackupSelection -> Maybe [Condition]
$sel:conditions:BackupSelection' :: BackupSelection -> Maybe Conditions
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Conditions" 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 Conditions
conditions,
(Key
"ListOfTags" 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 [Condition]
listOfTags,
(Key
"NotResources" 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]
notResources,
(Key
"Resources" 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]
resources,
forall a. a -> Maybe a
Prelude.Just (Key
"SelectionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
selectionName),
forall a. a -> Maybe a
Prelude.Just (Key
"IamRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
iamRoleArn)
]
)