{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Redshift.CreateScheduledAction
(
CreateScheduledAction (..),
newCreateScheduledAction,
createScheduledAction_startTime,
createScheduledAction_scheduledActionDescription,
createScheduledAction_enable,
createScheduledAction_endTime,
createScheduledAction_scheduledActionName,
createScheduledAction_targetAction,
createScheduledAction_schedule,
createScheduledAction_iamRole,
ScheduledAction (..),
newScheduledAction,
scheduledAction_state,
scheduledAction_targetAction,
scheduledAction_startTime,
scheduledAction_schedule,
scheduledAction_scheduledActionName,
scheduledAction_scheduledActionDescription,
scheduledAction_nextInvocations,
scheduledAction_endTime,
scheduledAction_iamRole,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateScheduledAction = CreateScheduledAction'
{
CreateScheduledAction -> Maybe ISO8601
startTime :: Prelude.Maybe Core.ISO8601,
CreateScheduledAction -> Maybe Text
scheduledActionDescription :: Prelude.Maybe Prelude.Text,
CreateScheduledAction -> Maybe Bool
enable :: Prelude.Maybe Prelude.Bool,
CreateScheduledAction -> Maybe ISO8601
endTime :: Prelude.Maybe Core.ISO8601,
CreateScheduledAction -> Text
scheduledActionName :: Prelude.Text,
CreateScheduledAction -> ScheduledActionType
targetAction :: ScheduledActionType,
CreateScheduledAction -> Text
schedule :: Prelude.Text,
CreateScheduledAction -> Text
iamRole :: Prelude.Text
}
deriving (CreateScheduledAction -> CreateScheduledAction -> Bool
(CreateScheduledAction -> CreateScheduledAction -> Bool)
-> (CreateScheduledAction -> CreateScheduledAction -> Bool)
-> Eq CreateScheduledAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScheduledAction -> CreateScheduledAction -> Bool
$c/= :: CreateScheduledAction -> CreateScheduledAction -> Bool
== :: CreateScheduledAction -> CreateScheduledAction -> Bool
$c== :: CreateScheduledAction -> CreateScheduledAction -> Bool
Prelude.Eq, ReadPrec [CreateScheduledAction]
ReadPrec CreateScheduledAction
Int -> ReadS CreateScheduledAction
ReadS [CreateScheduledAction]
(Int -> ReadS CreateScheduledAction)
-> ReadS [CreateScheduledAction]
-> ReadPrec CreateScheduledAction
-> ReadPrec [CreateScheduledAction]
-> Read CreateScheduledAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScheduledAction]
$creadListPrec :: ReadPrec [CreateScheduledAction]
readPrec :: ReadPrec CreateScheduledAction
$creadPrec :: ReadPrec CreateScheduledAction
readList :: ReadS [CreateScheduledAction]
$creadList :: ReadS [CreateScheduledAction]
readsPrec :: Int -> ReadS CreateScheduledAction
$creadsPrec :: Int -> ReadS CreateScheduledAction
Prelude.Read, Int -> CreateScheduledAction -> ShowS
[CreateScheduledAction] -> ShowS
CreateScheduledAction -> String
(Int -> CreateScheduledAction -> ShowS)
-> (CreateScheduledAction -> String)
-> ([CreateScheduledAction] -> ShowS)
-> Show CreateScheduledAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScheduledAction] -> ShowS
$cshowList :: [CreateScheduledAction] -> ShowS
show :: CreateScheduledAction -> String
$cshow :: CreateScheduledAction -> String
showsPrec :: Int -> CreateScheduledAction -> ShowS
$cshowsPrec :: Int -> CreateScheduledAction -> ShowS
Prelude.Show, (forall x. CreateScheduledAction -> Rep CreateScheduledAction x)
-> (forall x. Rep CreateScheduledAction x -> CreateScheduledAction)
-> Generic CreateScheduledAction
forall x. Rep CreateScheduledAction x -> CreateScheduledAction
forall x. CreateScheduledAction -> Rep CreateScheduledAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScheduledAction x -> CreateScheduledAction
$cfrom :: forall x. CreateScheduledAction -> Rep CreateScheduledAction x
Prelude.Generic)
newCreateScheduledAction ::
Prelude.Text ->
ScheduledActionType ->
Prelude.Text ->
Prelude.Text ->
CreateScheduledAction
newCreateScheduledAction :: Text
-> ScheduledActionType -> Text -> Text -> CreateScheduledAction
newCreateScheduledAction
Text
pScheduledActionName_
ScheduledActionType
pTargetAction_
Text
pSchedule_
Text
pIamRole_ =
CreateScheduledAction' :: Maybe ISO8601
-> Maybe Text
-> Maybe Bool
-> Maybe ISO8601
-> Text
-> ScheduledActionType
-> Text
-> Text
-> CreateScheduledAction
CreateScheduledAction'
{ $sel:startTime:CreateScheduledAction' :: Maybe ISO8601
startTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:scheduledActionDescription:CreateScheduledAction' :: Maybe Text
scheduledActionDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enable:CreateScheduledAction' :: Maybe Bool
enable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:endTime:CreateScheduledAction' :: Maybe ISO8601
endTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:scheduledActionName:CreateScheduledAction' :: Text
scheduledActionName = Text
pScheduledActionName_,
$sel:targetAction:CreateScheduledAction' :: ScheduledActionType
targetAction = ScheduledActionType
pTargetAction_,
$sel:schedule:CreateScheduledAction' :: Text
schedule = Text
pSchedule_,
$sel:iamRole:CreateScheduledAction' :: Text
iamRole = Text
pIamRole_
}
createScheduledAction_startTime :: Lens.Lens' CreateScheduledAction (Prelude.Maybe Prelude.UTCTime)
createScheduledAction_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_startTime = (CreateScheduledAction -> Maybe ISO8601)
-> (CreateScheduledAction
-> Maybe ISO8601 -> CreateScheduledAction)
-> Lens
CreateScheduledAction
CreateScheduledAction
(Maybe ISO8601)
(Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Maybe ISO8601
startTime :: Maybe ISO8601
$sel:startTime:CreateScheduledAction' :: CreateScheduledAction -> Maybe ISO8601
startTime} -> Maybe ISO8601
startTime) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Maybe ISO8601
a -> CreateScheduledAction
s {$sel:startTime:CreateScheduledAction' :: Maybe ISO8601
startTime = Maybe ISO8601
a} :: CreateScheduledAction) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> CreateScheduledAction -> f CreateScheduledAction)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateScheduledAction
-> f CreateScheduledAction
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
createScheduledAction_scheduledActionDescription :: Lens.Lens' CreateScheduledAction (Prelude.Maybe Prelude.Text)
createScheduledAction_scheduledActionDescription :: (Maybe Text -> f (Maybe Text))
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_scheduledActionDescription = (CreateScheduledAction -> Maybe Text)
-> (CreateScheduledAction -> Maybe Text -> CreateScheduledAction)
-> Lens
CreateScheduledAction
CreateScheduledAction
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Maybe Text
scheduledActionDescription :: Maybe Text
$sel:scheduledActionDescription:CreateScheduledAction' :: CreateScheduledAction -> Maybe Text
scheduledActionDescription} -> Maybe Text
scheduledActionDescription) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Maybe Text
a -> CreateScheduledAction
s {$sel:scheduledActionDescription:CreateScheduledAction' :: Maybe Text
scheduledActionDescription = Maybe Text
a} :: CreateScheduledAction)
createScheduledAction_enable :: Lens.Lens' CreateScheduledAction (Prelude.Maybe Prelude.Bool)
createScheduledAction_enable :: (Maybe Bool -> f (Maybe Bool))
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_enable = (CreateScheduledAction -> Maybe Bool)
-> (CreateScheduledAction -> Maybe Bool -> CreateScheduledAction)
-> Lens
CreateScheduledAction
CreateScheduledAction
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Maybe Bool
enable :: Maybe Bool
$sel:enable:CreateScheduledAction' :: CreateScheduledAction -> Maybe Bool
enable} -> Maybe Bool
enable) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Maybe Bool
a -> CreateScheduledAction
s {$sel:enable:CreateScheduledAction' :: Maybe Bool
enable = Maybe Bool
a} :: CreateScheduledAction)
createScheduledAction_endTime :: Lens.Lens' CreateScheduledAction (Prelude.Maybe Prelude.UTCTime)
createScheduledAction_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_endTime = (CreateScheduledAction -> Maybe ISO8601)
-> (CreateScheduledAction
-> Maybe ISO8601 -> CreateScheduledAction)
-> Lens
CreateScheduledAction
CreateScheduledAction
(Maybe ISO8601)
(Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Maybe ISO8601
endTime :: Maybe ISO8601
$sel:endTime:CreateScheduledAction' :: CreateScheduledAction -> Maybe ISO8601
endTime} -> Maybe ISO8601
endTime) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Maybe ISO8601
a -> CreateScheduledAction
s {$sel:endTime:CreateScheduledAction' :: Maybe ISO8601
endTime = Maybe ISO8601
a} :: CreateScheduledAction) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> CreateScheduledAction -> f CreateScheduledAction)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateScheduledAction
-> f CreateScheduledAction
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
createScheduledAction_scheduledActionName :: Lens.Lens' CreateScheduledAction Prelude.Text
createScheduledAction_scheduledActionName :: (Text -> f Text)
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_scheduledActionName = (CreateScheduledAction -> Text)
-> (CreateScheduledAction -> Text -> CreateScheduledAction)
-> Lens CreateScheduledAction CreateScheduledAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Text
scheduledActionName :: Text
$sel:scheduledActionName:CreateScheduledAction' :: CreateScheduledAction -> Text
scheduledActionName} -> Text
scheduledActionName) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Text
a -> CreateScheduledAction
s {$sel:scheduledActionName:CreateScheduledAction' :: Text
scheduledActionName = Text
a} :: CreateScheduledAction)
createScheduledAction_targetAction :: Lens.Lens' CreateScheduledAction ScheduledActionType
createScheduledAction_targetAction :: (ScheduledActionType -> f ScheduledActionType)
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_targetAction = (CreateScheduledAction -> ScheduledActionType)
-> (CreateScheduledAction
-> ScheduledActionType -> CreateScheduledAction)
-> Lens
CreateScheduledAction
CreateScheduledAction
ScheduledActionType
ScheduledActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {ScheduledActionType
targetAction :: ScheduledActionType
$sel:targetAction:CreateScheduledAction' :: CreateScheduledAction -> ScheduledActionType
targetAction} -> ScheduledActionType
targetAction) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} ScheduledActionType
a -> CreateScheduledAction
s {$sel:targetAction:CreateScheduledAction' :: ScheduledActionType
targetAction = ScheduledActionType
a} :: CreateScheduledAction)
createScheduledAction_schedule :: Lens.Lens' CreateScheduledAction Prelude.Text
createScheduledAction_schedule :: (Text -> f Text)
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_schedule = (CreateScheduledAction -> Text)
-> (CreateScheduledAction -> Text -> CreateScheduledAction)
-> Lens CreateScheduledAction CreateScheduledAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Text
schedule :: Text
$sel:schedule:CreateScheduledAction' :: CreateScheduledAction -> Text
schedule} -> Text
schedule) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Text
a -> CreateScheduledAction
s {$sel:schedule:CreateScheduledAction' :: Text
schedule = Text
a} :: CreateScheduledAction)
createScheduledAction_iamRole :: Lens.Lens' CreateScheduledAction Prelude.Text
createScheduledAction_iamRole :: (Text -> f Text)
-> CreateScheduledAction -> f CreateScheduledAction
createScheduledAction_iamRole = (CreateScheduledAction -> Text)
-> (CreateScheduledAction -> Text -> CreateScheduledAction)
-> Lens CreateScheduledAction CreateScheduledAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAction' {Text
iamRole :: Text
$sel:iamRole:CreateScheduledAction' :: CreateScheduledAction -> Text
iamRole} -> Text
iamRole) (\s :: CreateScheduledAction
s@CreateScheduledAction' {} Text
a -> CreateScheduledAction
s {$sel:iamRole:CreateScheduledAction' :: Text
iamRole = Text
a} :: CreateScheduledAction)
instance Core.AWSRequest CreateScheduledAction where
type
AWSResponse CreateScheduledAction =
ScheduledAction
request :: CreateScheduledAction -> Request CreateScheduledAction
request = Service -> CreateScheduledAction -> Request CreateScheduledAction
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateScheduledAction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateScheduledAction)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateScheduledAction))
-> Logger
-> Service
-> Proxy CreateScheduledAction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateScheduledAction)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"CreateScheduledActionResult"
(\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String ScheduledAction
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance Prelude.Hashable CreateScheduledAction
instance Prelude.NFData CreateScheduledAction
instance Core.ToHeaders CreateScheduledAction where
toHeaders :: CreateScheduledAction -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateScheduledAction -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateScheduledAction where
toPath :: CreateScheduledAction -> ByteString
toPath = ByteString -> CreateScheduledAction -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateScheduledAction where
toQuery :: CreateScheduledAction -> QueryString
toQuery CreateScheduledAction' {Maybe Bool
Maybe Text
Maybe ISO8601
Text
ScheduledActionType
iamRole :: Text
schedule :: Text
targetAction :: ScheduledActionType
scheduledActionName :: Text
endTime :: Maybe ISO8601
enable :: Maybe Bool
scheduledActionDescription :: Maybe Text
startTime :: Maybe ISO8601
$sel:iamRole:CreateScheduledAction' :: CreateScheduledAction -> Text
$sel:schedule:CreateScheduledAction' :: CreateScheduledAction -> Text
$sel:targetAction:CreateScheduledAction' :: CreateScheduledAction -> ScheduledActionType
$sel:scheduledActionName:CreateScheduledAction' :: CreateScheduledAction -> Text
$sel:endTime:CreateScheduledAction' :: CreateScheduledAction -> Maybe ISO8601
$sel:enable:CreateScheduledAction' :: CreateScheduledAction -> Maybe Bool
$sel:scheduledActionDescription:CreateScheduledAction' :: CreateScheduledAction -> Maybe Text
$sel:startTime:CreateScheduledAction' :: CreateScheduledAction -> Maybe ISO8601
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateScheduledAction" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"StartTime" ByteString -> Maybe ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ISO8601
startTime,
ByteString
"ScheduledActionDescription"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
scheduledActionDescription,
ByteString
"Enable" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
enable,
ByteString
"EndTime" ByteString -> Maybe ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ISO8601
endTime,
ByteString
"ScheduledActionName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
scheduledActionName,
ByteString
"TargetAction" ByteString -> ScheduledActionType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ScheduledActionType
targetAction,
ByteString
"Schedule" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
schedule,
ByteString
"IamRole" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
iamRole
]