{-# 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.Redshift.Types.ScheduledAction
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Redshift.Types.ScheduledAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.ScheduledActionState
import Amazonka.Redshift.Types.ScheduledActionType

-- | Describes a scheduled action. You can use a scheduled action to trigger
-- some Amazon Redshift API operations on a schedule. For information about
-- which API operations can be scheduled, see ScheduledActionType.
--
-- /See:/ 'newScheduledAction' smart constructor.
data ScheduledAction = ScheduledAction'
  { -- | The state of the scheduled action. For example, @DISABLED@.
    ScheduledAction -> Maybe ScheduledActionState
state :: Prelude.Maybe ScheduledActionState,
    -- | A JSON format string of the Amazon Redshift API operation with input
    -- parameters.
    --
    -- \"@{\\\"ResizeCluster\\\":{\\\"NodeType\\\":\\\"ds2.8xlarge\\\",\\\"ClusterIdentifier\\\":\\\"my-test-cluster\\\",\\\"NumberOfNodes\\\":3}}@\".
    ScheduledAction -> Maybe ScheduledActionType
targetAction :: Prelude.Maybe ScheduledActionType,
    -- | The start time in UTC when the schedule is active. Before this time, the
    -- scheduled action does not trigger.
    ScheduledAction -> Maybe ISO8601
startTime :: Prelude.Maybe Core.ISO8601,
    -- | The schedule for a one-time (at format) or recurring (cron format)
    -- scheduled action. Schedule invocations must be separated by at least one
    -- hour.
    --
    -- Format of at expressions is \"@at(yyyy-mm-ddThh:mm:ss)@\". For example,
    -- \"@at(2016-03-04T17:27:00)@\".
    --
    -- Format of cron expressions is
    -- \"@cron(Minutes Hours Day-of-month Month Day-of-week Year)@\". For
    -- example, \"@cron(0 10 ? * MON *)@\". For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions Cron Expressions>
    -- in the /Amazon CloudWatch Events User Guide/.
    ScheduledAction -> Maybe Text
schedule :: Prelude.Maybe Prelude.Text,
    -- | The name of the scheduled action.
    ScheduledAction -> Maybe Text
scheduledActionName :: Prelude.Maybe Prelude.Text,
    -- | The description of the scheduled action.
    ScheduledAction -> Maybe Text
scheduledActionDescription :: Prelude.Maybe Prelude.Text,
    -- | List of times when the scheduled action will run.
    ScheduledAction -> Maybe [ISO8601]
nextInvocations :: Prelude.Maybe [Core.ISO8601],
    -- | The end time in UTC when the schedule is no longer active. After this
    -- time, the scheduled action does not trigger.
    ScheduledAction -> Maybe ISO8601
endTime :: Prelude.Maybe Core.ISO8601,
    -- | The IAM role to assume to run the scheduled action. This IAM role must
    -- have permission to run the Amazon Redshift API operation in the
    -- scheduled action. This IAM role must allow the Amazon Redshift scheduler
    -- (Principal scheduler.redshift.amazonaws.com) to assume permissions on
    -- your behalf. For more information about the IAM role to use with the
    -- Amazon Redshift scheduler, see
    -- <https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html Using Identity-Based Policies for Amazon Redshift>
    -- in the /Amazon Redshift Cluster Management Guide/.
    ScheduledAction -> Maybe Text
iamRole :: Prelude.Maybe Prelude.Text
  }
  deriving (ScheduledAction -> ScheduledAction -> Bool
(ScheduledAction -> ScheduledAction -> Bool)
-> (ScheduledAction -> ScheduledAction -> Bool)
-> Eq ScheduledAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduledAction -> ScheduledAction -> Bool
$c/= :: ScheduledAction -> ScheduledAction -> Bool
== :: ScheduledAction -> ScheduledAction -> Bool
$c== :: ScheduledAction -> ScheduledAction -> Bool
Prelude.Eq, ReadPrec [ScheduledAction]
ReadPrec ScheduledAction
Int -> ReadS ScheduledAction
ReadS [ScheduledAction]
(Int -> ReadS ScheduledAction)
-> ReadS [ScheduledAction]
-> ReadPrec ScheduledAction
-> ReadPrec [ScheduledAction]
-> Read ScheduledAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduledAction]
$creadListPrec :: ReadPrec [ScheduledAction]
readPrec :: ReadPrec ScheduledAction
$creadPrec :: ReadPrec ScheduledAction
readList :: ReadS [ScheduledAction]
$creadList :: ReadS [ScheduledAction]
readsPrec :: Int -> ReadS ScheduledAction
$creadsPrec :: Int -> ReadS ScheduledAction
Prelude.Read, Int -> ScheduledAction -> ShowS
[ScheduledAction] -> ShowS
ScheduledAction -> String
(Int -> ScheduledAction -> ShowS)
-> (ScheduledAction -> String)
-> ([ScheduledAction] -> ShowS)
-> Show ScheduledAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduledAction] -> ShowS
$cshowList :: [ScheduledAction] -> ShowS
show :: ScheduledAction -> String
$cshow :: ScheduledAction -> String
showsPrec :: Int -> ScheduledAction -> ShowS
$cshowsPrec :: Int -> ScheduledAction -> ShowS
Prelude.Show, (forall x. ScheduledAction -> Rep ScheduledAction x)
-> (forall x. Rep ScheduledAction x -> ScheduledAction)
-> Generic ScheduledAction
forall x. Rep ScheduledAction x -> ScheduledAction
forall x. ScheduledAction -> Rep ScheduledAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduledAction x -> ScheduledAction
$cfrom :: forall x. ScheduledAction -> Rep ScheduledAction x
Prelude.Generic)

-- |
-- Create a value of 'ScheduledAction' 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:
--
-- 'state', 'scheduledAction_state' - The state of the scheduled action. For example, @DISABLED@.
--
-- 'targetAction', 'scheduledAction_targetAction' - A JSON format string of the Amazon Redshift API operation with input
-- parameters.
--
-- \"@{\\\"ResizeCluster\\\":{\\\"NodeType\\\":\\\"ds2.8xlarge\\\",\\\"ClusterIdentifier\\\":\\\"my-test-cluster\\\",\\\"NumberOfNodes\\\":3}}@\".
--
-- 'startTime', 'scheduledAction_startTime' - The start time in UTC when the schedule is active. Before this time, the
-- scheduled action does not trigger.
--
-- 'schedule', 'scheduledAction_schedule' - The schedule for a one-time (at format) or recurring (cron format)
-- scheduled action. Schedule invocations must be separated by at least one
-- hour.
--
-- Format of at expressions is \"@at(yyyy-mm-ddThh:mm:ss)@\". For example,
-- \"@at(2016-03-04T17:27:00)@\".
--
-- Format of cron expressions is
-- \"@cron(Minutes Hours Day-of-month Month Day-of-week Year)@\". For
-- example, \"@cron(0 10 ? * MON *)@\". For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions Cron Expressions>
-- in the /Amazon CloudWatch Events User Guide/.
--
-- 'scheduledActionName', 'scheduledAction_scheduledActionName' - The name of the scheduled action.
--
-- 'scheduledActionDescription', 'scheduledAction_scheduledActionDescription' - The description of the scheduled action.
--
-- 'nextInvocations', 'scheduledAction_nextInvocations' - List of times when the scheduled action will run.
--
-- 'endTime', 'scheduledAction_endTime' - The end time in UTC when the schedule is no longer active. After this
-- time, the scheduled action does not trigger.
--
-- 'iamRole', 'scheduledAction_iamRole' - The IAM role to assume to run the scheduled action. This IAM role must
-- have permission to run the Amazon Redshift API operation in the
-- scheduled action. This IAM role must allow the Amazon Redshift scheduler
-- (Principal scheduler.redshift.amazonaws.com) to assume permissions on
-- your behalf. For more information about the IAM role to use with the
-- Amazon Redshift scheduler, see
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html Using Identity-Based Policies for Amazon Redshift>
-- in the /Amazon Redshift Cluster Management Guide/.
newScheduledAction ::
  ScheduledAction
newScheduledAction :: ScheduledAction
newScheduledAction =
  ScheduledAction' :: Maybe ScheduledActionState
-> Maybe ScheduledActionType
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ISO8601]
-> Maybe ISO8601
-> Maybe Text
-> ScheduledAction
ScheduledAction'
    { $sel:state:ScheduledAction' :: Maybe ScheduledActionState
state = Maybe ScheduledActionState
forall a. Maybe a
Prelude.Nothing,
      $sel:targetAction:ScheduledAction' :: Maybe ScheduledActionType
targetAction = Maybe ScheduledActionType
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ScheduledAction' :: Maybe ISO8601
startTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:schedule:ScheduledAction' :: Maybe Text
schedule = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledActionName:ScheduledAction' :: Maybe Text
scheduledActionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledActionDescription:ScheduledAction' :: Maybe Text
scheduledActionDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextInvocations:ScheduledAction' :: Maybe [ISO8601]
nextInvocations = Maybe [ISO8601]
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ScheduledAction' :: Maybe ISO8601
endTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:iamRole:ScheduledAction' :: Maybe Text
iamRole = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the scheduled action. For example, @DISABLED@.
scheduledAction_state :: Lens.Lens' ScheduledAction (Prelude.Maybe ScheduledActionState)
scheduledAction_state :: (Maybe ScheduledActionState -> f (Maybe ScheduledActionState))
-> ScheduledAction -> f ScheduledAction
scheduledAction_state = (ScheduledAction -> Maybe ScheduledActionState)
-> (ScheduledAction
    -> Maybe ScheduledActionState -> ScheduledAction)
-> Lens
     ScheduledAction
     ScheduledAction
     (Maybe ScheduledActionState)
     (Maybe ScheduledActionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe ScheduledActionState
state :: Maybe ScheduledActionState
$sel:state:ScheduledAction' :: ScheduledAction -> Maybe ScheduledActionState
state} -> Maybe ScheduledActionState
state) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe ScheduledActionState
a -> ScheduledAction
s {$sel:state:ScheduledAction' :: Maybe ScheduledActionState
state = Maybe ScheduledActionState
a} :: ScheduledAction)

-- | A JSON format string of the Amazon Redshift API operation with input
-- parameters.
--
-- \"@{\\\"ResizeCluster\\\":{\\\"NodeType\\\":\\\"ds2.8xlarge\\\",\\\"ClusterIdentifier\\\":\\\"my-test-cluster\\\",\\\"NumberOfNodes\\\":3}}@\".
scheduledAction_targetAction :: Lens.Lens' ScheduledAction (Prelude.Maybe ScheduledActionType)
scheduledAction_targetAction :: (Maybe ScheduledActionType -> f (Maybe ScheduledActionType))
-> ScheduledAction -> f ScheduledAction
scheduledAction_targetAction = (ScheduledAction -> Maybe ScheduledActionType)
-> (ScheduledAction
    -> Maybe ScheduledActionType -> ScheduledAction)
-> Lens
     ScheduledAction
     ScheduledAction
     (Maybe ScheduledActionType)
     (Maybe ScheduledActionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe ScheduledActionType
targetAction :: Maybe ScheduledActionType
$sel:targetAction:ScheduledAction' :: ScheduledAction -> Maybe ScheduledActionType
targetAction} -> Maybe ScheduledActionType
targetAction) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe ScheduledActionType
a -> ScheduledAction
s {$sel:targetAction:ScheduledAction' :: Maybe ScheduledActionType
targetAction = Maybe ScheduledActionType
a} :: ScheduledAction)

-- | The start time in UTC when the schedule is active. Before this time, the
-- scheduled action does not trigger.
scheduledAction_startTime :: Lens.Lens' ScheduledAction (Prelude.Maybe Prelude.UTCTime)
scheduledAction_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ScheduledAction -> f ScheduledAction
scheduledAction_startTime = (ScheduledAction -> Maybe ISO8601)
-> (ScheduledAction -> Maybe ISO8601 -> ScheduledAction)
-> Lens
     ScheduledAction ScheduledAction (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe ISO8601
startTime :: Maybe ISO8601
$sel:startTime:ScheduledAction' :: ScheduledAction -> Maybe ISO8601
startTime} -> Maybe ISO8601
startTime) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe ISO8601
a -> ScheduledAction
s {$sel:startTime:ScheduledAction' :: Maybe ISO8601
startTime = Maybe ISO8601
a} :: ScheduledAction) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ScheduledAction -> f ScheduledAction)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ScheduledAction
-> f ScheduledAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The schedule for a one-time (at format) or recurring (cron format)
-- scheduled action. Schedule invocations must be separated by at least one
-- hour.
--
-- Format of at expressions is \"@at(yyyy-mm-ddThh:mm:ss)@\". For example,
-- \"@at(2016-03-04T17:27:00)@\".
--
-- Format of cron expressions is
-- \"@cron(Minutes Hours Day-of-month Month Day-of-week Year)@\". For
-- example, \"@cron(0 10 ? * MON *)@\". For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions Cron Expressions>
-- in the /Amazon CloudWatch Events User Guide/.
scheduledAction_schedule :: Lens.Lens' ScheduledAction (Prelude.Maybe Prelude.Text)
scheduledAction_schedule :: (Maybe Text -> f (Maybe Text))
-> ScheduledAction -> f ScheduledAction
scheduledAction_schedule = (ScheduledAction -> Maybe Text)
-> (ScheduledAction -> Maybe Text -> ScheduledAction)
-> Lens ScheduledAction ScheduledAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe Text
schedule :: Maybe Text
$sel:schedule:ScheduledAction' :: ScheduledAction -> Maybe Text
schedule} -> Maybe Text
schedule) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe Text
a -> ScheduledAction
s {$sel:schedule:ScheduledAction' :: Maybe Text
schedule = Maybe Text
a} :: ScheduledAction)

-- | The name of the scheduled action.
scheduledAction_scheduledActionName :: Lens.Lens' ScheduledAction (Prelude.Maybe Prelude.Text)
scheduledAction_scheduledActionName :: (Maybe Text -> f (Maybe Text))
-> ScheduledAction -> f ScheduledAction
scheduledAction_scheduledActionName = (ScheduledAction -> Maybe Text)
-> (ScheduledAction -> Maybe Text -> ScheduledAction)
-> Lens ScheduledAction ScheduledAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe Text
scheduledActionName :: Maybe Text
$sel:scheduledActionName:ScheduledAction' :: ScheduledAction -> Maybe Text
scheduledActionName} -> Maybe Text
scheduledActionName) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe Text
a -> ScheduledAction
s {$sel:scheduledActionName:ScheduledAction' :: Maybe Text
scheduledActionName = Maybe Text
a} :: ScheduledAction)

-- | The description of the scheduled action.
scheduledAction_scheduledActionDescription :: Lens.Lens' ScheduledAction (Prelude.Maybe Prelude.Text)
scheduledAction_scheduledActionDescription :: (Maybe Text -> f (Maybe Text))
-> ScheduledAction -> f ScheduledAction
scheduledAction_scheduledActionDescription = (ScheduledAction -> Maybe Text)
-> (ScheduledAction -> Maybe Text -> ScheduledAction)
-> Lens ScheduledAction ScheduledAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe Text
scheduledActionDescription :: Maybe Text
$sel:scheduledActionDescription:ScheduledAction' :: ScheduledAction -> Maybe Text
scheduledActionDescription} -> Maybe Text
scheduledActionDescription) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe Text
a -> ScheduledAction
s {$sel:scheduledActionDescription:ScheduledAction' :: Maybe Text
scheduledActionDescription = Maybe Text
a} :: ScheduledAction)

-- | List of times when the scheduled action will run.
scheduledAction_nextInvocations :: Lens.Lens' ScheduledAction (Prelude.Maybe [Prelude.UTCTime])
scheduledAction_nextInvocations :: (Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> ScheduledAction -> f ScheduledAction
scheduledAction_nextInvocations = (ScheduledAction -> Maybe [ISO8601])
-> (ScheduledAction -> Maybe [ISO8601] -> ScheduledAction)
-> Lens
     ScheduledAction ScheduledAction (Maybe [ISO8601]) (Maybe [ISO8601])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe [ISO8601]
nextInvocations :: Maybe [ISO8601]
$sel:nextInvocations:ScheduledAction' :: ScheduledAction -> Maybe [ISO8601]
nextInvocations} -> Maybe [ISO8601]
nextInvocations) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe [ISO8601]
a -> ScheduledAction
s {$sel:nextInvocations:ScheduledAction' :: Maybe [ISO8601]
nextInvocations = Maybe [ISO8601]
a} :: ScheduledAction) ((Maybe [ISO8601] -> f (Maybe [ISO8601]))
 -> ScheduledAction -> f ScheduledAction)
-> ((Maybe [UTCTime] -> f (Maybe [UTCTime]))
    -> Maybe [ISO8601] -> f (Maybe [ISO8601]))
-> (Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> ScheduledAction
-> f ScheduledAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ISO8601] [ISO8601] [UTCTime] [UTCTime]
-> Iso
     (Maybe [ISO8601])
     (Maybe [ISO8601])
     (Maybe [UTCTime])
     (Maybe [UTCTime])
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 AnIso [ISO8601] [ISO8601] [UTCTime] [UTCTime]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The end time in UTC when the schedule is no longer active. After this
-- time, the scheduled action does not trigger.
scheduledAction_endTime :: Lens.Lens' ScheduledAction (Prelude.Maybe Prelude.UTCTime)
scheduledAction_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ScheduledAction -> f ScheduledAction
scheduledAction_endTime = (ScheduledAction -> Maybe ISO8601)
-> (ScheduledAction -> Maybe ISO8601 -> ScheduledAction)
-> Lens
     ScheduledAction ScheduledAction (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe ISO8601
endTime :: Maybe ISO8601
$sel:endTime:ScheduledAction' :: ScheduledAction -> Maybe ISO8601
endTime} -> Maybe ISO8601
endTime) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe ISO8601
a -> ScheduledAction
s {$sel:endTime:ScheduledAction' :: Maybe ISO8601
endTime = Maybe ISO8601
a} :: ScheduledAction) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ScheduledAction -> f ScheduledAction)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ScheduledAction
-> f ScheduledAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The IAM role to assume to run the scheduled action. This IAM role must
-- have permission to run the Amazon Redshift API operation in the
-- scheduled action. This IAM role must allow the Amazon Redshift scheduler
-- (Principal scheduler.redshift.amazonaws.com) to assume permissions on
-- your behalf. For more information about the IAM role to use with the
-- Amazon Redshift scheduler, see
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html Using Identity-Based Policies for Amazon Redshift>
-- in the /Amazon Redshift Cluster Management Guide/.
scheduledAction_iamRole :: Lens.Lens' ScheduledAction (Prelude.Maybe Prelude.Text)
scheduledAction_iamRole :: (Maybe Text -> f (Maybe Text))
-> ScheduledAction -> f ScheduledAction
scheduledAction_iamRole = (ScheduledAction -> Maybe Text)
-> (ScheduledAction -> Maybe Text -> ScheduledAction)
-> Lens ScheduledAction ScheduledAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAction' {Maybe Text
iamRole :: Maybe Text
$sel:iamRole:ScheduledAction' :: ScheduledAction -> Maybe Text
iamRole} -> Maybe Text
iamRole) (\s :: ScheduledAction
s@ScheduledAction' {} Maybe Text
a -> ScheduledAction
s {$sel:iamRole:ScheduledAction' :: Maybe Text
iamRole = Maybe Text
a} :: ScheduledAction)

instance Core.FromXML ScheduledAction where
  parseXML :: [Node] -> Either String ScheduledAction
parseXML [Node]
x =
    Maybe ScheduledActionState
-> Maybe ScheduledActionType
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ISO8601]
-> Maybe ISO8601
-> Maybe Text
-> ScheduledAction
ScheduledAction'
      (Maybe ScheduledActionState
 -> Maybe ScheduledActionType
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [ISO8601]
 -> Maybe ISO8601
 -> Maybe Text
 -> ScheduledAction)
-> Either String (Maybe ScheduledActionState)
-> Either
     String
     (Maybe ScheduledActionType
      -> Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [ISO8601]
      -> Maybe ISO8601
      -> Maybe Text
      -> ScheduledAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ScheduledActionState)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"State")
      Either
  String
  (Maybe ScheduledActionType
   -> Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [ISO8601]
   -> Maybe ISO8601
   -> Maybe Text
   -> ScheduledAction)
-> Either String (Maybe ScheduledActionType)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [ISO8601]
      -> Maybe ISO8601
      -> Maybe Text
      -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ScheduledActionType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TargetAction")
      Either
  String
  (Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [ISO8601]
   -> Maybe ISO8601
   -> Maybe Text
   -> ScheduledAction)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [ISO8601]
      -> Maybe ISO8601
      -> Maybe Text
      -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StartTime")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [ISO8601]
   -> Maybe ISO8601
   -> Maybe Text
   -> ScheduledAction)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe [ISO8601]
      -> Maybe ISO8601
      -> Maybe Text
      -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Schedule")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe [ISO8601]
   -> Maybe ISO8601
   -> Maybe Text
   -> ScheduledAction)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [ISO8601]
      -> Maybe ISO8601
      -> Maybe Text
      -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ScheduledActionName")
      Either
  String
  (Maybe Text
   -> Maybe [ISO8601]
   -> Maybe ISO8601
   -> Maybe Text
   -> ScheduledAction)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ISO8601] -> Maybe ISO8601 -> Maybe Text -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ScheduledActionDescription")
      Either
  String
  (Maybe [ISO8601] -> Maybe ISO8601 -> Maybe Text -> ScheduledAction)
-> Either String (Maybe [ISO8601])
-> Either String (Maybe ISO8601 -> Maybe Text -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextInvocations" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [ISO8601]))
-> Either String (Maybe [ISO8601])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ISO8601])
-> [Node] -> Either String (Maybe [ISO8601])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ISO8601]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"ScheduledActionTime")
                  )
      Either String (Maybe ISO8601 -> Maybe Text -> ScheduledAction)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> ScheduledAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EndTime")
      Either String (Maybe Text -> ScheduledAction)
-> Either String (Maybe Text) -> Either String ScheduledAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IamRole")

instance Prelude.Hashable ScheduledAction

instance Prelude.NFData ScheduledAction