{-# 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.Schedule
-- 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.Schedule where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DLM.Types.ArchiveRule
import Amazonka.DLM.Types.CreateRule
import Amazonka.DLM.Types.CrossRegionCopyRule
import Amazonka.DLM.Types.DeprecateRule
import Amazonka.DLM.Types.FastRestoreRule
import Amazonka.DLM.Types.RetainRule
import Amazonka.DLM.Types.ShareRule
import Amazonka.DLM.Types.Tag
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | __[Snapshot and AMI policies only]__ Specifies a schedule for a snapshot
-- or AMI lifecycle policy.
--
-- /See:/ 'newSchedule' smart constructor.
data Schedule = Schedule'
  { -- | __[Snapshot policies that target volumes only]__ The snapshot archiving
    -- rule for the schedule. When you specify an archiving rule, snapshots are
    -- automatically moved from the standard tier to the archive tier once the
    -- schedule\'s retention threshold is met. Snapshots are then retained in
    -- the archive tier for the archive retention period that you specify.
    --
    -- For more information about using snapshot archiving, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive Considerations for snapshot lifecycle policies>.
    Schedule -> Maybe ArchiveRule
archiveRule :: Prelude.Maybe ArchiveRule,
    -- | Copy all user-defined tags on a source volume to snapshots of the volume
    -- created by this policy.
    Schedule -> Maybe Bool
copyTags :: Prelude.Maybe Prelude.Bool,
    -- | The creation rule.
    Schedule -> Maybe CreateRule
createRule :: Prelude.Maybe CreateRule,
    -- | Specifies a rule for copying snapshots or AMIs across regions.
    --
    -- You can\'t specify cross-Region copy rules for policies that create
    -- snapshots on an Outpost. If the policy creates snapshots in a Region,
    -- then snapshots can be copied to up to three Regions or Outposts.
    Schedule -> Maybe [CrossRegionCopyRule]
crossRegionCopyRules :: Prelude.Maybe [CrossRegionCopyRule],
    -- | __[AMI policies only]__ The AMI deprecation rule for the schedule.
    Schedule -> Maybe DeprecateRule
deprecateRule :: Prelude.Maybe DeprecateRule,
    -- | __[Snapshot policies only]__ The rule for enabling fast snapshot
    -- restore.
    Schedule -> Maybe FastRestoreRule
fastRestoreRule :: Prelude.Maybe FastRestoreRule,
    -- | The name of the schedule.
    Schedule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The retention rule for snapshots or AMIs created by the policy.
    Schedule -> Maybe RetainRule
retainRule :: Prelude.Maybe RetainRule,
    -- | __[Snapshot policies only]__ The rule for sharing snapshots with other
    -- Amazon Web Services accounts.
    Schedule -> Maybe [ShareRule]
shareRules :: Prelude.Maybe [ShareRule],
    -- | The tags to apply to policy-created resources. These user-defined tags
    -- are in addition to the Amazon Web Services-added lifecycle tags.
    Schedule -> Maybe [Tag]
tagsToAdd :: Prelude.Maybe [Tag],
    -- | __[AMI policies and snapshot policies that target instances only]__ A
    -- collection of key\/value pairs with values determined dynamically when
    -- the policy is executed. Keys may be any valid Amazon EC2 tag key. Values
    -- must be in one of the two following formats: @$(instance-id)@ or
    -- @$(timestamp)@. Variable tags are only valid for EBS Snapshot Management
    -- – Instance policies.
    Schedule -> Maybe [Tag]
variableTags :: Prelude.Maybe [Tag]
  }
  deriving (Schedule -> Schedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Schedule -> Schedule -> Bool
$c/= :: Schedule -> Schedule -> Bool
== :: Schedule -> Schedule -> Bool
$c== :: Schedule -> Schedule -> Bool
Prelude.Eq, ReadPrec [Schedule]
ReadPrec Schedule
Int -> ReadS Schedule
ReadS [Schedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Schedule]
$creadListPrec :: ReadPrec [Schedule]
readPrec :: ReadPrec Schedule
$creadPrec :: ReadPrec Schedule
readList :: ReadS [Schedule]
$creadList :: ReadS [Schedule]
readsPrec :: Int -> ReadS Schedule
$creadsPrec :: Int -> ReadS Schedule
Prelude.Read, Int -> Schedule -> ShowS
[Schedule] -> ShowS
Schedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Schedule] -> ShowS
$cshowList :: [Schedule] -> ShowS
show :: Schedule -> String
$cshow :: Schedule -> String
showsPrec :: Int -> Schedule -> ShowS
$cshowsPrec :: Int -> Schedule -> ShowS
Prelude.Show, forall x. Rep Schedule x -> Schedule
forall x. Schedule -> Rep Schedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Schedule x -> Schedule
$cfrom :: forall x. Schedule -> Rep Schedule x
Prelude.Generic)

-- |
-- Create a value of 'Schedule' 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:
--
-- 'archiveRule', 'schedule_archiveRule' - __[Snapshot policies that target volumes only]__ The snapshot archiving
-- rule for the schedule. When you specify an archiving rule, snapshots are
-- automatically moved from the standard tier to the archive tier once the
-- schedule\'s retention threshold is met. Snapshots are then retained in
-- the archive tier for the archive retention period that you specify.
--
-- For more information about using snapshot archiving, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive Considerations for snapshot lifecycle policies>.
--
-- 'copyTags', 'schedule_copyTags' - Copy all user-defined tags on a source volume to snapshots of the volume
-- created by this policy.
--
-- 'createRule', 'schedule_createRule' - The creation rule.
--
-- 'crossRegionCopyRules', 'schedule_crossRegionCopyRules' - Specifies a rule for copying snapshots or AMIs across regions.
--
-- You can\'t specify cross-Region copy rules for policies that create
-- snapshots on an Outpost. If the policy creates snapshots in a Region,
-- then snapshots can be copied to up to three Regions or Outposts.
--
-- 'deprecateRule', 'schedule_deprecateRule' - __[AMI policies only]__ The AMI deprecation rule for the schedule.
--
-- 'fastRestoreRule', 'schedule_fastRestoreRule' - __[Snapshot policies only]__ The rule for enabling fast snapshot
-- restore.
--
-- 'name', 'schedule_name' - The name of the schedule.
--
-- 'retainRule', 'schedule_retainRule' - The retention rule for snapshots or AMIs created by the policy.
--
-- 'shareRules', 'schedule_shareRules' - __[Snapshot policies only]__ The rule for sharing snapshots with other
-- Amazon Web Services accounts.
--
-- 'tagsToAdd', 'schedule_tagsToAdd' - The tags to apply to policy-created resources. These user-defined tags
-- are in addition to the Amazon Web Services-added lifecycle tags.
--
-- 'variableTags', 'schedule_variableTags' - __[AMI policies and snapshot policies that target instances only]__ A
-- collection of key\/value pairs with values determined dynamically when
-- the policy is executed. Keys may be any valid Amazon EC2 tag key. Values
-- must be in one of the two following formats: @$(instance-id)@ or
-- @$(timestamp)@. Variable tags are only valid for EBS Snapshot Management
-- – Instance policies.
newSchedule ::
  Schedule
newSchedule :: Schedule
newSchedule =
  Schedule'
    { $sel:archiveRule:Schedule' :: Maybe ArchiveRule
archiveRule = forall a. Maybe a
Prelude.Nothing,
      $sel:copyTags:Schedule' :: Maybe Bool
copyTags = forall a. Maybe a
Prelude.Nothing,
      $sel:createRule:Schedule' :: Maybe CreateRule
createRule = forall a. Maybe a
Prelude.Nothing,
      $sel:crossRegionCopyRules:Schedule' :: Maybe [CrossRegionCopyRule]
crossRegionCopyRules = forall a. Maybe a
Prelude.Nothing,
      $sel:deprecateRule:Schedule' :: Maybe DeprecateRule
deprecateRule = forall a. Maybe a
Prelude.Nothing,
      $sel:fastRestoreRule:Schedule' :: Maybe FastRestoreRule
fastRestoreRule = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Schedule' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:retainRule:Schedule' :: Maybe RetainRule
retainRule = forall a. Maybe a
Prelude.Nothing,
      $sel:shareRules:Schedule' :: Maybe [ShareRule]
shareRules = forall a. Maybe a
Prelude.Nothing,
      $sel:tagsToAdd:Schedule' :: Maybe [Tag]
tagsToAdd = forall a. Maybe a
Prelude.Nothing,
      $sel:variableTags:Schedule' :: Maybe [Tag]
variableTags = forall a. Maybe a
Prelude.Nothing
    }

-- | __[Snapshot policies that target volumes only]__ The snapshot archiving
-- rule for the schedule. When you specify an archiving rule, snapshots are
-- automatically moved from the standard tier to the archive tier once the
-- schedule\'s retention threshold is met. Snapshots are then retained in
-- the archive tier for the archive retention period that you specify.
--
-- For more information about using snapshot archiving, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive Considerations for snapshot lifecycle policies>.
schedule_archiveRule :: Lens.Lens' Schedule (Prelude.Maybe ArchiveRule)
schedule_archiveRule :: Lens' Schedule (Maybe ArchiveRule)
schedule_archiveRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe ArchiveRule
archiveRule :: Maybe ArchiveRule
$sel:archiveRule:Schedule' :: Schedule -> Maybe ArchiveRule
archiveRule} -> Maybe ArchiveRule
archiveRule) (\s :: Schedule
s@Schedule' {} Maybe ArchiveRule
a -> Schedule
s {$sel:archiveRule:Schedule' :: Maybe ArchiveRule
archiveRule = Maybe ArchiveRule
a} :: Schedule)

-- | Copy all user-defined tags on a source volume to snapshots of the volume
-- created by this policy.
schedule_copyTags :: Lens.Lens' Schedule (Prelude.Maybe Prelude.Bool)
schedule_copyTags :: Lens' Schedule (Maybe Bool)
schedule_copyTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe Bool
copyTags :: Maybe Bool
$sel:copyTags:Schedule' :: Schedule -> Maybe Bool
copyTags} -> Maybe Bool
copyTags) (\s :: Schedule
s@Schedule' {} Maybe Bool
a -> Schedule
s {$sel:copyTags:Schedule' :: Maybe Bool
copyTags = Maybe Bool
a} :: Schedule)

-- | The creation rule.
schedule_createRule :: Lens.Lens' Schedule (Prelude.Maybe CreateRule)
schedule_createRule :: Lens' Schedule (Maybe CreateRule)
schedule_createRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe CreateRule
createRule :: Maybe CreateRule
$sel:createRule:Schedule' :: Schedule -> Maybe CreateRule
createRule} -> Maybe CreateRule
createRule) (\s :: Schedule
s@Schedule' {} Maybe CreateRule
a -> Schedule
s {$sel:createRule:Schedule' :: Maybe CreateRule
createRule = Maybe CreateRule
a} :: Schedule)

-- | Specifies a rule for copying snapshots or AMIs across regions.
--
-- You can\'t specify cross-Region copy rules for policies that create
-- snapshots on an Outpost. If the policy creates snapshots in a Region,
-- then snapshots can be copied to up to three Regions or Outposts.
schedule_crossRegionCopyRules :: Lens.Lens' Schedule (Prelude.Maybe [CrossRegionCopyRule])
schedule_crossRegionCopyRules :: Lens' Schedule (Maybe [CrossRegionCopyRule])
schedule_crossRegionCopyRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe [CrossRegionCopyRule]
crossRegionCopyRules :: Maybe [CrossRegionCopyRule]
$sel:crossRegionCopyRules:Schedule' :: Schedule -> Maybe [CrossRegionCopyRule]
crossRegionCopyRules} -> Maybe [CrossRegionCopyRule]
crossRegionCopyRules) (\s :: Schedule
s@Schedule' {} Maybe [CrossRegionCopyRule]
a -> Schedule
s {$sel:crossRegionCopyRules:Schedule' :: Maybe [CrossRegionCopyRule]
crossRegionCopyRules = Maybe [CrossRegionCopyRule]
a} :: Schedule) 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

-- | __[AMI policies only]__ The AMI deprecation rule for the schedule.
schedule_deprecateRule :: Lens.Lens' Schedule (Prelude.Maybe DeprecateRule)
schedule_deprecateRule :: Lens' Schedule (Maybe DeprecateRule)
schedule_deprecateRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe DeprecateRule
deprecateRule :: Maybe DeprecateRule
$sel:deprecateRule:Schedule' :: Schedule -> Maybe DeprecateRule
deprecateRule} -> Maybe DeprecateRule
deprecateRule) (\s :: Schedule
s@Schedule' {} Maybe DeprecateRule
a -> Schedule
s {$sel:deprecateRule:Schedule' :: Maybe DeprecateRule
deprecateRule = Maybe DeprecateRule
a} :: Schedule)

-- | __[Snapshot policies only]__ The rule for enabling fast snapshot
-- restore.
schedule_fastRestoreRule :: Lens.Lens' Schedule (Prelude.Maybe FastRestoreRule)
schedule_fastRestoreRule :: Lens' Schedule (Maybe FastRestoreRule)
schedule_fastRestoreRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe FastRestoreRule
fastRestoreRule :: Maybe FastRestoreRule
$sel:fastRestoreRule:Schedule' :: Schedule -> Maybe FastRestoreRule
fastRestoreRule} -> Maybe FastRestoreRule
fastRestoreRule) (\s :: Schedule
s@Schedule' {} Maybe FastRestoreRule
a -> Schedule
s {$sel:fastRestoreRule:Schedule' :: Maybe FastRestoreRule
fastRestoreRule = Maybe FastRestoreRule
a} :: Schedule)

-- | The name of the schedule.
schedule_name :: Lens.Lens' Schedule (Prelude.Maybe Prelude.Text)
schedule_name :: Lens' Schedule (Maybe Text)
schedule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe Text
name :: Maybe Text
$sel:name:Schedule' :: Schedule -> Maybe Text
name} -> Maybe Text
name) (\s :: Schedule
s@Schedule' {} Maybe Text
a -> Schedule
s {$sel:name:Schedule' :: Maybe Text
name = Maybe Text
a} :: Schedule)

-- | The retention rule for snapshots or AMIs created by the policy.
schedule_retainRule :: Lens.Lens' Schedule (Prelude.Maybe RetainRule)
schedule_retainRule :: Lens' Schedule (Maybe RetainRule)
schedule_retainRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe RetainRule
retainRule :: Maybe RetainRule
$sel:retainRule:Schedule' :: Schedule -> Maybe RetainRule
retainRule} -> Maybe RetainRule
retainRule) (\s :: Schedule
s@Schedule' {} Maybe RetainRule
a -> Schedule
s {$sel:retainRule:Schedule' :: Maybe RetainRule
retainRule = Maybe RetainRule
a} :: Schedule)

-- | __[Snapshot policies only]__ The rule for sharing snapshots with other
-- Amazon Web Services accounts.
schedule_shareRules :: Lens.Lens' Schedule (Prelude.Maybe [ShareRule])
schedule_shareRules :: Lens' Schedule (Maybe [ShareRule])
schedule_shareRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe [ShareRule]
shareRules :: Maybe [ShareRule]
$sel:shareRules:Schedule' :: Schedule -> Maybe [ShareRule]
shareRules} -> Maybe [ShareRule]
shareRules) (\s :: Schedule
s@Schedule' {} Maybe [ShareRule]
a -> Schedule
s {$sel:shareRules:Schedule' :: Maybe [ShareRule]
shareRules = Maybe [ShareRule]
a} :: Schedule) 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

-- | The tags to apply to policy-created resources. These user-defined tags
-- are in addition to the Amazon Web Services-added lifecycle tags.
schedule_tagsToAdd :: Lens.Lens' Schedule (Prelude.Maybe [Tag])
schedule_tagsToAdd :: Lens' Schedule (Maybe [Tag])
schedule_tagsToAdd = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe [Tag]
tagsToAdd :: Maybe [Tag]
$sel:tagsToAdd:Schedule' :: Schedule -> Maybe [Tag]
tagsToAdd} -> Maybe [Tag]
tagsToAdd) (\s :: Schedule
s@Schedule' {} Maybe [Tag]
a -> Schedule
s {$sel:tagsToAdd:Schedule' :: Maybe [Tag]
tagsToAdd = Maybe [Tag]
a} :: Schedule) 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

-- | __[AMI policies and snapshot policies that target instances only]__ A
-- collection of key\/value pairs with values determined dynamically when
-- the policy is executed. Keys may be any valid Amazon EC2 tag key. Values
-- must be in one of the two following formats: @$(instance-id)@ or
-- @$(timestamp)@. Variable tags are only valid for EBS Snapshot Management
-- – Instance policies.
schedule_variableTags :: Lens.Lens' Schedule (Prelude.Maybe [Tag])
schedule_variableTags :: Lens' Schedule (Maybe [Tag])
schedule_variableTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Schedule' {Maybe [Tag]
variableTags :: Maybe [Tag]
$sel:variableTags:Schedule' :: Schedule -> Maybe [Tag]
variableTags} -> Maybe [Tag]
variableTags) (\s :: Schedule
s@Schedule' {} Maybe [Tag]
a -> Schedule
s {$sel:variableTags:Schedule' :: Maybe [Tag]
variableTags = Maybe [Tag]
a} :: Schedule) 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

instance Data.FromJSON Schedule where
  parseJSON :: Value -> Parser Schedule
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Schedule"
      ( \Object
x ->
          Maybe ArchiveRule
-> Maybe Bool
-> Maybe CreateRule
-> Maybe [CrossRegionCopyRule]
-> Maybe DeprecateRule
-> Maybe FastRestoreRule
-> Maybe Text
-> Maybe RetainRule
-> Maybe [ShareRule]
-> Maybe [Tag]
-> Maybe [Tag]
-> Schedule
Schedule'
            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
"ArchiveRule")
            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
"CreateRule")
            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
"CrossRegionCopyRules"
                            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
"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
"FastRestoreRule")
            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
"Name")
            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
"ShareRules" 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
"TagsToAdd" 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
"VariableTags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Schedule where
  hashWithSalt :: Int -> Schedule -> Int
hashWithSalt Int
_salt Schedule' {Maybe Bool
Maybe [CrossRegionCopyRule]
Maybe [ShareRule]
Maybe [Tag]
Maybe Text
Maybe CreateRule
Maybe ArchiveRule
Maybe RetainRule
Maybe FastRestoreRule
Maybe DeprecateRule
variableTags :: Maybe [Tag]
tagsToAdd :: Maybe [Tag]
shareRules :: Maybe [ShareRule]
retainRule :: Maybe RetainRule
name :: Maybe Text
fastRestoreRule :: Maybe FastRestoreRule
deprecateRule :: Maybe DeprecateRule
crossRegionCopyRules :: Maybe [CrossRegionCopyRule]
createRule :: Maybe CreateRule
copyTags :: Maybe Bool
archiveRule :: Maybe ArchiveRule
$sel:variableTags:Schedule' :: Schedule -> Maybe [Tag]
$sel:tagsToAdd:Schedule' :: Schedule -> Maybe [Tag]
$sel:shareRules:Schedule' :: Schedule -> Maybe [ShareRule]
$sel:retainRule:Schedule' :: Schedule -> Maybe RetainRule
$sel:name:Schedule' :: Schedule -> Maybe Text
$sel:fastRestoreRule:Schedule' :: Schedule -> Maybe FastRestoreRule
$sel:deprecateRule:Schedule' :: Schedule -> Maybe DeprecateRule
$sel:crossRegionCopyRules:Schedule' :: Schedule -> Maybe [CrossRegionCopyRule]
$sel:createRule:Schedule' :: Schedule -> Maybe CreateRule
$sel:copyTags:Schedule' :: Schedule -> Maybe Bool
$sel:archiveRule:Schedule' :: Schedule -> Maybe ArchiveRule
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ArchiveRule
archiveRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
copyTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateRule
createRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CrossRegionCopyRule]
crossRegionCopyRules
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeprecateRule
deprecateRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FastRestoreRule
fastRestoreRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RetainRule
retainRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ShareRule]
shareRules
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tagsToAdd
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
variableTags

instance Prelude.NFData Schedule where
  rnf :: Schedule -> ()
rnf Schedule' {Maybe Bool
Maybe [CrossRegionCopyRule]
Maybe [ShareRule]
Maybe [Tag]
Maybe Text
Maybe CreateRule
Maybe ArchiveRule
Maybe RetainRule
Maybe FastRestoreRule
Maybe DeprecateRule
variableTags :: Maybe [Tag]
tagsToAdd :: Maybe [Tag]
shareRules :: Maybe [ShareRule]
retainRule :: Maybe RetainRule
name :: Maybe Text
fastRestoreRule :: Maybe FastRestoreRule
deprecateRule :: Maybe DeprecateRule
crossRegionCopyRules :: Maybe [CrossRegionCopyRule]
createRule :: Maybe CreateRule
copyTags :: Maybe Bool
archiveRule :: Maybe ArchiveRule
$sel:variableTags:Schedule' :: Schedule -> Maybe [Tag]
$sel:tagsToAdd:Schedule' :: Schedule -> Maybe [Tag]
$sel:shareRules:Schedule' :: Schedule -> Maybe [ShareRule]
$sel:retainRule:Schedule' :: Schedule -> Maybe RetainRule
$sel:name:Schedule' :: Schedule -> Maybe Text
$sel:fastRestoreRule:Schedule' :: Schedule -> Maybe FastRestoreRule
$sel:deprecateRule:Schedule' :: Schedule -> Maybe DeprecateRule
$sel:crossRegionCopyRules:Schedule' :: Schedule -> Maybe [CrossRegionCopyRule]
$sel:createRule:Schedule' :: Schedule -> Maybe CreateRule
$sel:copyTags:Schedule' :: Schedule -> Maybe Bool
$sel:archiveRule:Schedule' :: Schedule -> Maybe ArchiveRule
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ArchiveRule
archiveRule
      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 CreateRule
createRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CrossRegionCopyRule]
crossRegionCopyRules
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeprecateRule
deprecateRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FastRestoreRule
fastRestoreRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RetainRule
retainRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ShareRule]
shareRules
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tagsToAdd
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
variableTags

instance Data.ToJSON Schedule where
  toJSON :: Schedule -> Value
toJSON Schedule' {Maybe Bool
Maybe [CrossRegionCopyRule]
Maybe [ShareRule]
Maybe [Tag]
Maybe Text
Maybe CreateRule
Maybe ArchiveRule
Maybe RetainRule
Maybe FastRestoreRule
Maybe DeprecateRule
variableTags :: Maybe [Tag]
tagsToAdd :: Maybe [Tag]
shareRules :: Maybe [ShareRule]
retainRule :: Maybe RetainRule
name :: Maybe Text
fastRestoreRule :: Maybe FastRestoreRule
deprecateRule :: Maybe DeprecateRule
crossRegionCopyRules :: Maybe [CrossRegionCopyRule]
createRule :: Maybe CreateRule
copyTags :: Maybe Bool
archiveRule :: Maybe ArchiveRule
$sel:variableTags:Schedule' :: Schedule -> Maybe [Tag]
$sel:tagsToAdd:Schedule' :: Schedule -> Maybe [Tag]
$sel:shareRules:Schedule' :: Schedule -> Maybe [ShareRule]
$sel:retainRule:Schedule' :: Schedule -> Maybe RetainRule
$sel:name:Schedule' :: Schedule -> Maybe Text
$sel:fastRestoreRule:Schedule' :: Schedule -> Maybe FastRestoreRule
$sel:deprecateRule:Schedule' :: Schedule -> Maybe DeprecateRule
$sel:crossRegionCopyRules:Schedule' :: Schedule -> Maybe [CrossRegionCopyRule]
$sel:createRule:Schedule' :: Schedule -> Maybe CreateRule
$sel:copyTags:Schedule' :: Schedule -> Maybe Bool
$sel:archiveRule:Schedule' :: Schedule -> Maybe ArchiveRule
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ArchiveRule" 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 ArchiveRule
archiveRule,
            (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
"CreateRule" 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 CreateRule
createRule,
            (Key
"CrossRegionCopyRules" 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 [CrossRegionCopyRule]
crossRegionCopyRules,
            (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 DeprecateRule
deprecateRule,
            (Key
"FastRestoreRule" 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 FastRestoreRule
fastRestoreRule,
            (Key
"Name" 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
name,
            (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 RetainRule
retainRule,
            (Key
"ShareRules" 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 [ShareRule]
shareRules,
            (Key
"TagsToAdd" 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 [Tag]
tagsToAdd,
            (Key
"VariableTags" 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 [Tag]
variableTags
          ]
      )