{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DLM.Types.CrossRegionCopyRule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DLM.Types.CrossRegionCopyRule where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DLM.Types.CrossRegionCopyDeprecateRule
import Amazonka.DLM.Types.CrossRegionCopyRetainRule
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | __[Snapshot and AMI policies only]__ Specifies a cross-Region copy rule
-- for snapshot and AMI policies.
--
-- To specify a cross-Region copy action for event-based polices, use
-- CrossRegionCopyAction.
--
-- /See:/ 'newCrossRegionCopyRule' smart constructor.
data CrossRegionCopyRule = CrossRegionCopyRule'
  { -- | The Amazon Resource Name (ARN) of the KMS key to use for EBS encryption.
    -- If this parameter is not specified, the default KMS key for the account
    -- is used.
    CrossRegionCopyRule -> Maybe Text
cmkArn :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether to copy all user-defined tags from the source snapshot
    -- or AMI to the cross-Region copy.
    CrossRegionCopyRule -> Maybe Bool
copyTags :: Prelude.Maybe Prelude.Bool,
    -- | __[AMI policies only]__ The AMI deprecation rule for cross-Region AMI
    -- copies created by the rule.
    CrossRegionCopyRule -> Maybe CrossRegionCopyDeprecateRule
deprecateRule :: Prelude.Maybe CrossRegionCopyDeprecateRule,
    -- | The retention rule that indicates how long the cross-Region snapshot or
    -- AMI copies are to be retained in the destination Region.
    CrossRegionCopyRule -> Maybe CrossRegionCopyRetainRule
retainRule :: Prelude.Maybe CrossRegionCopyRetainRule,
    -- | The target Region or the Amazon Resource Name (ARN) of the target
    -- Outpost for the snapshot copies.
    --
    -- Use this parameter instead of __TargetRegion__. Do not specify both.
    CrossRegionCopyRule -> Maybe Text
target :: Prelude.Maybe Prelude.Text,
    -- | Avoid using this parameter when creating new policies. Instead, use
    -- __Target__ to specify a target Region or a target Outpost for snapshot
    -- copies.
    --
    -- For policies created before the __Target__ parameter was introduced,
    -- this parameter indicates the target Region for snapshot copies.
    CrossRegionCopyRule -> Maybe Text
targetRegion :: Prelude.Maybe Prelude.Text,
    -- | To encrypt a copy of an unencrypted snapshot if encryption by default is
    -- not enabled, enable encryption using this parameter. Copies of encrypted
    -- snapshots are encrypted, even if this parameter is false or if
    -- encryption by default is not enabled.
    CrossRegionCopyRule -> Bool
encrypted :: Prelude.Bool
  }
  deriving (CrossRegionCopyRule -> CrossRegionCopyRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CrossRegionCopyRule -> CrossRegionCopyRule -> Bool
$c/= :: CrossRegionCopyRule -> CrossRegionCopyRule -> Bool
== :: CrossRegionCopyRule -> CrossRegionCopyRule -> Bool
$c== :: CrossRegionCopyRule -> CrossRegionCopyRule -> Bool
Prelude.Eq, ReadPrec [CrossRegionCopyRule]
ReadPrec CrossRegionCopyRule
Int -> ReadS CrossRegionCopyRule
ReadS [CrossRegionCopyRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CrossRegionCopyRule]
$creadListPrec :: ReadPrec [CrossRegionCopyRule]
readPrec :: ReadPrec CrossRegionCopyRule
$creadPrec :: ReadPrec CrossRegionCopyRule
readList :: ReadS [CrossRegionCopyRule]
$creadList :: ReadS [CrossRegionCopyRule]
readsPrec :: Int -> ReadS CrossRegionCopyRule
$creadsPrec :: Int -> ReadS CrossRegionCopyRule
Prelude.Read, Int -> CrossRegionCopyRule -> ShowS
[CrossRegionCopyRule] -> ShowS
CrossRegionCopyRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CrossRegionCopyRule] -> ShowS
$cshowList :: [CrossRegionCopyRule] -> ShowS
show :: CrossRegionCopyRule -> String
$cshow :: CrossRegionCopyRule -> String
showsPrec :: Int -> CrossRegionCopyRule -> ShowS
$cshowsPrec :: Int -> CrossRegionCopyRule -> ShowS
Prelude.Show, forall x. Rep CrossRegionCopyRule x -> CrossRegionCopyRule
forall x. CrossRegionCopyRule -> Rep CrossRegionCopyRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CrossRegionCopyRule x -> CrossRegionCopyRule
$cfrom :: forall x. CrossRegionCopyRule -> Rep CrossRegionCopyRule x
Prelude.Generic)

-- |
-- Create a value of 'CrossRegionCopyRule' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'cmkArn', 'crossRegionCopyRule_cmkArn' - The Amazon Resource Name (ARN) of the KMS key to use for EBS encryption.
-- If this parameter is not specified, the default KMS key for the account
-- is used.
--
-- 'copyTags', 'crossRegionCopyRule_copyTags' - Indicates whether to copy all user-defined tags from the source snapshot
-- or AMI to the cross-Region copy.
--
-- 'deprecateRule', 'crossRegionCopyRule_deprecateRule' - __[AMI policies only]__ The AMI deprecation rule for cross-Region AMI
-- copies created by the rule.
--
-- 'retainRule', 'crossRegionCopyRule_retainRule' - The retention rule that indicates how long the cross-Region snapshot or
-- AMI copies are to be retained in the destination Region.
--
-- 'target', 'crossRegionCopyRule_target' - The target Region or the Amazon Resource Name (ARN) of the target
-- Outpost for the snapshot copies.
--
-- Use this parameter instead of __TargetRegion__. Do not specify both.
--
-- 'targetRegion', 'crossRegionCopyRule_targetRegion' - Avoid using this parameter when creating new policies. Instead, use
-- __Target__ to specify a target Region or a target Outpost for snapshot
-- copies.
--
-- For policies created before the __Target__ parameter was introduced,
-- this parameter indicates the target Region for snapshot copies.
--
-- 'encrypted', 'crossRegionCopyRule_encrypted' - To encrypt a copy of an unencrypted snapshot if encryption by default is
-- not enabled, enable encryption using this parameter. Copies of encrypted
-- snapshots are encrypted, even if this parameter is false or if
-- encryption by default is not enabled.
newCrossRegionCopyRule ::
  -- | 'encrypted'
  Prelude.Bool ->
  CrossRegionCopyRule
newCrossRegionCopyRule :: Bool -> CrossRegionCopyRule
newCrossRegionCopyRule Bool
pEncrypted_ =
  CrossRegionCopyRule'
    { $sel:cmkArn:CrossRegionCopyRule' :: Maybe Text
cmkArn = forall a. Maybe a
Prelude.Nothing,
      $sel:copyTags:CrossRegionCopyRule' :: Maybe Bool
copyTags = forall a. Maybe a
Prelude.Nothing,
      $sel:deprecateRule:CrossRegionCopyRule' :: Maybe CrossRegionCopyDeprecateRule
deprecateRule = forall a. Maybe a
Prelude.Nothing,
      $sel:retainRule:CrossRegionCopyRule' :: Maybe CrossRegionCopyRetainRule
retainRule = forall a. Maybe a
Prelude.Nothing,
      $sel:target:CrossRegionCopyRule' :: Maybe Text
target = forall a. Maybe a
Prelude.Nothing,
      $sel:targetRegion:CrossRegionCopyRule' :: Maybe Text
targetRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:encrypted:CrossRegionCopyRule' :: Bool
encrypted = Bool
pEncrypted_
    }

-- | The Amazon Resource Name (ARN) of the KMS key to use for EBS encryption.
-- If this parameter is not specified, the default KMS key for the account
-- is used.
crossRegionCopyRule_cmkArn :: Lens.Lens' CrossRegionCopyRule (Prelude.Maybe Prelude.Text)
crossRegionCopyRule_cmkArn :: Lens' CrossRegionCopyRule (Maybe Text)
crossRegionCopyRule_cmkArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Maybe Text
cmkArn :: Maybe Text
$sel:cmkArn:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
cmkArn} -> Maybe Text
cmkArn) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Maybe Text
a -> CrossRegionCopyRule
s {$sel:cmkArn:CrossRegionCopyRule' :: Maybe Text
cmkArn = Maybe Text
a} :: CrossRegionCopyRule)

-- | Indicates whether to copy all user-defined tags from the source snapshot
-- or AMI to the cross-Region copy.
crossRegionCopyRule_copyTags :: Lens.Lens' CrossRegionCopyRule (Prelude.Maybe Prelude.Bool)
crossRegionCopyRule_copyTags :: Lens' CrossRegionCopyRule (Maybe Bool)
crossRegionCopyRule_copyTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Maybe Bool
copyTags :: Maybe Bool
$sel:copyTags:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Bool
copyTags} -> Maybe Bool
copyTags) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Maybe Bool
a -> CrossRegionCopyRule
s {$sel:copyTags:CrossRegionCopyRule' :: Maybe Bool
copyTags = Maybe Bool
a} :: CrossRegionCopyRule)

-- | __[AMI policies only]__ The AMI deprecation rule for cross-Region AMI
-- copies created by the rule.
crossRegionCopyRule_deprecateRule :: Lens.Lens' CrossRegionCopyRule (Prelude.Maybe CrossRegionCopyDeprecateRule)
crossRegionCopyRule_deprecateRule :: Lens' CrossRegionCopyRule (Maybe CrossRegionCopyDeprecateRule)
crossRegionCopyRule_deprecateRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Maybe CrossRegionCopyDeprecateRule
deprecateRule :: Maybe CrossRegionCopyDeprecateRule
$sel:deprecateRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyDeprecateRule
deprecateRule} -> Maybe CrossRegionCopyDeprecateRule
deprecateRule) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Maybe CrossRegionCopyDeprecateRule
a -> CrossRegionCopyRule
s {$sel:deprecateRule:CrossRegionCopyRule' :: Maybe CrossRegionCopyDeprecateRule
deprecateRule = Maybe CrossRegionCopyDeprecateRule
a} :: CrossRegionCopyRule)

-- | The retention rule that indicates how long the cross-Region snapshot or
-- AMI copies are to be retained in the destination Region.
crossRegionCopyRule_retainRule :: Lens.Lens' CrossRegionCopyRule (Prelude.Maybe CrossRegionCopyRetainRule)
crossRegionCopyRule_retainRule :: Lens' CrossRegionCopyRule (Maybe CrossRegionCopyRetainRule)
crossRegionCopyRule_retainRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Maybe CrossRegionCopyRetainRule
retainRule :: Maybe CrossRegionCopyRetainRule
$sel:retainRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyRetainRule
retainRule} -> Maybe CrossRegionCopyRetainRule
retainRule) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Maybe CrossRegionCopyRetainRule
a -> CrossRegionCopyRule
s {$sel:retainRule:CrossRegionCopyRule' :: Maybe CrossRegionCopyRetainRule
retainRule = Maybe CrossRegionCopyRetainRule
a} :: CrossRegionCopyRule)

-- | The target Region or the Amazon Resource Name (ARN) of the target
-- Outpost for the snapshot copies.
--
-- Use this parameter instead of __TargetRegion__. Do not specify both.
crossRegionCopyRule_target :: Lens.Lens' CrossRegionCopyRule (Prelude.Maybe Prelude.Text)
crossRegionCopyRule_target :: Lens' CrossRegionCopyRule (Maybe Text)
crossRegionCopyRule_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Maybe Text
target :: Maybe Text
$sel:target:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
target} -> Maybe Text
target) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Maybe Text
a -> CrossRegionCopyRule
s {$sel:target:CrossRegionCopyRule' :: Maybe Text
target = Maybe Text
a} :: CrossRegionCopyRule)

-- | Avoid using this parameter when creating new policies. Instead, use
-- __Target__ to specify a target Region or a target Outpost for snapshot
-- copies.
--
-- For policies created before the __Target__ parameter was introduced,
-- this parameter indicates the target Region for snapshot copies.
crossRegionCopyRule_targetRegion :: Lens.Lens' CrossRegionCopyRule (Prelude.Maybe Prelude.Text)
crossRegionCopyRule_targetRegion :: Lens' CrossRegionCopyRule (Maybe Text)
crossRegionCopyRule_targetRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Maybe Text
targetRegion :: Maybe Text
$sel:targetRegion:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
targetRegion} -> Maybe Text
targetRegion) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Maybe Text
a -> CrossRegionCopyRule
s {$sel:targetRegion:CrossRegionCopyRule' :: Maybe Text
targetRegion = Maybe Text
a} :: CrossRegionCopyRule)

-- | To encrypt a copy of an unencrypted snapshot if encryption by default is
-- not enabled, enable encryption using this parameter. Copies of encrypted
-- snapshots are encrypted, even if this parameter is false or if
-- encryption by default is not enabled.
crossRegionCopyRule_encrypted :: Lens.Lens' CrossRegionCopyRule Prelude.Bool
crossRegionCopyRule_encrypted :: Lens' CrossRegionCopyRule Bool
crossRegionCopyRule_encrypted = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRule' {Bool
encrypted :: Bool
$sel:encrypted:CrossRegionCopyRule' :: CrossRegionCopyRule -> Bool
encrypted} -> Bool
encrypted) (\s :: CrossRegionCopyRule
s@CrossRegionCopyRule' {} Bool
a -> CrossRegionCopyRule
s {$sel:encrypted:CrossRegionCopyRule' :: Bool
encrypted = Bool
a} :: CrossRegionCopyRule)

instance Data.FromJSON CrossRegionCopyRule where
  parseJSON :: Value -> Parser CrossRegionCopyRule
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CrossRegionCopyRule"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe CrossRegionCopyDeprecateRule
-> Maybe CrossRegionCopyRetainRule
-> Maybe Text
-> Maybe Text
-> Bool
-> CrossRegionCopyRule
CrossRegionCopyRule'
            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
"CmkArn")
            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
"CopyTags")
            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
"DeprecateRule")
            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
"RetainRule")
            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
"Target")
            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
"TargetRegion")
            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
"Encrypted")
      )

instance Prelude.Hashable CrossRegionCopyRule where
  hashWithSalt :: Int -> CrossRegionCopyRule -> Int
hashWithSalt Int
_salt CrossRegionCopyRule' {Bool
Maybe Bool
Maybe Text
Maybe CrossRegionCopyRetainRule
Maybe CrossRegionCopyDeprecateRule
encrypted :: Bool
targetRegion :: Maybe Text
target :: Maybe Text
retainRule :: Maybe CrossRegionCopyRetainRule
deprecateRule :: Maybe CrossRegionCopyDeprecateRule
copyTags :: Maybe Bool
cmkArn :: Maybe Text
$sel:encrypted:CrossRegionCopyRule' :: CrossRegionCopyRule -> Bool
$sel:targetRegion:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
$sel:target:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
$sel:retainRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyRetainRule
$sel:deprecateRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyDeprecateRule
$sel:copyTags:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Bool
$sel:cmkArn:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cmkArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
copyTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CrossRegionCopyDeprecateRule
deprecateRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CrossRegionCopyRetainRule
retainRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
target
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
encrypted

instance Prelude.NFData CrossRegionCopyRule where
  rnf :: CrossRegionCopyRule -> ()
rnf CrossRegionCopyRule' {Bool
Maybe Bool
Maybe Text
Maybe CrossRegionCopyRetainRule
Maybe CrossRegionCopyDeprecateRule
encrypted :: Bool
targetRegion :: Maybe Text
target :: Maybe Text
retainRule :: Maybe CrossRegionCopyRetainRule
deprecateRule :: Maybe CrossRegionCopyDeprecateRule
copyTags :: Maybe Bool
cmkArn :: Maybe Text
$sel:encrypted:CrossRegionCopyRule' :: CrossRegionCopyRule -> Bool
$sel:targetRegion:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
$sel:target:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
$sel:retainRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyRetainRule
$sel:deprecateRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyDeprecateRule
$sel:copyTags:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Bool
$sel:cmkArn:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cmkArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
copyTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CrossRegionCopyDeprecateRule
deprecateRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CrossRegionCopyRetainRule
retainRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
target
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
encrypted

instance Data.ToJSON CrossRegionCopyRule where
  toJSON :: CrossRegionCopyRule -> Value
toJSON CrossRegionCopyRule' {Bool
Maybe Bool
Maybe Text
Maybe CrossRegionCopyRetainRule
Maybe CrossRegionCopyDeprecateRule
encrypted :: Bool
targetRegion :: Maybe Text
target :: Maybe Text
retainRule :: Maybe CrossRegionCopyRetainRule
deprecateRule :: Maybe CrossRegionCopyDeprecateRule
copyTags :: Maybe Bool
cmkArn :: Maybe Text
$sel:encrypted:CrossRegionCopyRule' :: CrossRegionCopyRule -> Bool
$sel:targetRegion:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
$sel:target:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
$sel:retainRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyRetainRule
$sel:deprecateRule:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe CrossRegionCopyDeprecateRule
$sel:copyTags:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Bool
$sel:cmkArn:CrossRegionCopyRule' :: CrossRegionCopyRule -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CmkArn" 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
cmkArn,
            (Key
"CopyTags" 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 Bool
copyTags,
            (Key
"DeprecateRule" 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 CrossRegionCopyDeprecateRule
deprecateRule,
            (Key
"RetainRule" 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 CrossRegionCopyRetainRule
retainRule,
            (Key
"Target" 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
target,
            (Key
"TargetRegion" 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
targetRegion,
            forall a. a -> Maybe a
Prelude.Just (Key
"Encrypted" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
encrypted)
          ]
      )