{-# 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.CopyAction where
import Amazonka.Backup.Types.Lifecycle
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 CopyAction = CopyAction'
{ CopyAction -> Maybe Lifecycle
lifecycle :: Prelude.Maybe Lifecycle,
CopyAction -> Text
destinationBackupVaultArn :: Prelude.Text
}
deriving (CopyAction -> CopyAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyAction -> CopyAction -> Bool
$c/= :: CopyAction -> CopyAction -> Bool
== :: CopyAction -> CopyAction -> Bool
$c== :: CopyAction -> CopyAction -> Bool
Prelude.Eq, ReadPrec [CopyAction]
ReadPrec CopyAction
Int -> ReadS CopyAction
ReadS [CopyAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyAction]
$creadListPrec :: ReadPrec [CopyAction]
readPrec :: ReadPrec CopyAction
$creadPrec :: ReadPrec CopyAction
readList :: ReadS [CopyAction]
$creadList :: ReadS [CopyAction]
readsPrec :: Int -> ReadS CopyAction
$creadsPrec :: Int -> ReadS CopyAction
Prelude.Read, Int -> CopyAction -> ShowS
[CopyAction] -> ShowS
CopyAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyAction] -> ShowS
$cshowList :: [CopyAction] -> ShowS
show :: CopyAction -> String
$cshow :: CopyAction -> String
showsPrec :: Int -> CopyAction -> ShowS
$cshowsPrec :: Int -> CopyAction -> ShowS
Prelude.Show, forall x. Rep CopyAction x -> CopyAction
forall x. CopyAction -> Rep CopyAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyAction x -> CopyAction
$cfrom :: forall x. CopyAction -> Rep CopyAction x
Prelude.Generic)
newCopyAction ::
Prelude.Text ->
CopyAction
newCopyAction :: Text -> CopyAction
newCopyAction Text
pDestinationBackupVaultArn_ =
CopyAction'
{ $sel:lifecycle:CopyAction' :: Maybe Lifecycle
lifecycle = forall a. Maybe a
Prelude.Nothing,
$sel:destinationBackupVaultArn:CopyAction' :: Text
destinationBackupVaultArn =
Text
pDestinationBackupVaultArn_
}
copyAction_lifecycle :: Lens.Lens' CopyAction (Prelude.Maybe Lifecycle)
copyAction_lifecycle :: Lens' CopyAction (Maybe Lifecycle)
copyAction_lifecycle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyAction' {Maybe Lifecycle
lifecycle :: Maybe Lifecycle
$sel:lifecycle:CopyAction' :: CopyAction -> Maybe Lifecycle
lifecycle} -> Maybe Lifecycle
lifecycle) (\s :: CopyAction
s@CopyAction' {} Maybe Lifecycle
a -> CopyAction
s {$sel:lifecycle:CopyAction' :: Maybe Lifecycle
lifecycle = Maybe Lifecycle
a} :: CopyAction)
copyAction_destinationBackupVaultArn :: Lens.Lens' CopyAction Prelude.Text
copyAction_destinationBackupVaultArn :: Lens' CopyAction Text
copyAction_destinationBackupVaultArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyAction' {Text
destinationBackupVaultArn :: Text
$sel:destinationBackupVaultArn:CopyAction' :: CopyAction -> Text
destinationBackupVaultArn} -> Text
destinationBackupVaultArn) (\s :: CopyAction
s@CopyAction' {} Text
a -> CopyAction
s {$sel:destinationBackupVaultArn:CopyAction' :: Text
destinationBackupVaultArn = Text
a} :: CopyAction)
instance Data.FromJSON CopyAction where
parseJSON :: Value -> Parser CopyAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CopyAction"
( \Object
x ->
Maybe Lifecycle -> Text -> CopyAction
CopyAction'
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
"Lifecycle")
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
"DestinationBackupVaultArn")
)
instance Prelude.Hashable CopyAction where
hashWithSalt :: Int -> CopyAction -> Int
hashWithSalt Int
_salt CopyAction' {Maybe Lifecycle
Text
destinationBackupVaultArn :: Text
lifecycle :: Maybe Lifecycle
$sel:destinationBackupVaultArn:CopyAction' :: CopyAction -> Text
$sel:lifecycle:CopyAction' :: CopyAction -> Maybe Lifecycle
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Lifecycle
lifecycle
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationBackupVaultArn
instance Prelude.NFData CopyAction where
rnf :: CopyAction -> ()
rnf CopyAction' {Maybe Lifecycle
Text
destinationBackupVaultArn :: Text
lifecycle :: Maybe Lifecycle
$sel:destinationBackupVaultArn:CopyAction' :: CopyAction -> Text
$sel:lifecycle:CopyAction' :: CopyAction -> Maybe Lifecycle
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Lifecycle
lifecycle
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationBackupVaultArn
instance Data.ToJSON CopyAction where
toJSON :: CopyAction -> Value
toJSON CopyAction' {Maybe Lifecycle
Text
destinationBackupVaultArn :: Text
lifecycle :: Maybe Lifecycle
$sel:destinationBackupVaultArn:CopyAction' :: CopyAction -> Text
$sel:lifecycle:CopyAction' :: CopyAction -> Maybe Lifecycle
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Lifecycle" 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 Lifecycle
lifecycle,
forall a. a -> Maybe a
Prelude.Just
( Key
"DestinationBackupVaultArn"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destinationBackupVaultArn
)
]
)