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

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

-- |
-- Module      : Amazonka.CloudWatchEvents.StartReplay
-- 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)
--
-- Starts the specified replay. Events are not necessarily replayed in the
-- exact same order that they were added to the archive. A replay processes
-- events to replay based on the time in the event, and replays them using
-- 1 minute intervals. If you specify an @EventStartTime@ and an
-- @EventEndTime@ that covers a 20 minute time range, the events are
-- replayed from the first minute of that 20 minute range first. Then the
-- events from the second minute are replayed. You can use @DescribeReplay@
-- to determine the progress of a replay. The value returned for
-- @EventLastReplayedTime@ indicates the time within the specified time
-- range associated with the last event replayed.
module Amazonka.CloudWatchEvents.StartReplay
  ( -- * Creating a Request
    StartReplay (..),
    newStartReplay,

    -- * Request Lenses
    startReplay_description,
    startReplay_replayName,
    startReplay_eventSourceArn,
    startReplay_eventStartTime,
    startReplay_eventEndTime,
    startReplay_destination,

    -- * Destructuring the Response
    StartReplayResponse (..),
    newStartReplayResponse,

    -- * Response Lenses
    startReplayResponse_state,
    startReplayResponse_replayStartTime,
    startReplayResponse_replayArn,
    startReplayResponse_stateReason,
    startReplayResponse_httpStatus,
  )
where

import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStartReplay' smart constructor.
data StartReplay = StartReplay'
  { -- | A description for the replay to start.
    StartReplay -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the replay to start.
    StartReplay -> Text
replayName :: Prelude.Text,
    -- | The ARN of the archive to replay events from.
    StartReplay -> Text
eventSourceArn :: Prelude.Text,
    -- | A time stamp for the time to start replaying events. Only events that
    -- occurred between the @EventStartTime@ and @EventEndTime@ are replayed.
    StartReplay -> POSIX
eventStartTime :: Core.POSIX,
    -- | A time stamp for the time to stop replaying events. Only events that
    -- occurred between the @EventStartTime@ and @EventEndTime@ are replayed.
    StartReplay -> POSIX
eventEndTime :: Core.POSIX,
    -- | A @ReplayDestination@ object that includes details about the destination
    -- for the replay.
    StartReplay -> ReplayDestination
destination :: ReplayDestination
  }
  deriving (StartReplay -> StartReplay -> Bool
(StartReplay -> StartReplay -> Bool)
-> (StartReplay -> StartReplay -> Bool) -> Eq StartReplay
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartReplay -> StartReplay -> Bool
$c/= :: StartReplay -> StartReplay -> Bool
== :: StartReplay -> StartReplay -> Bool
$c== :: StartReplay -> StartReplay -> Bool
Prelude.Eq, ReadPrec [StartReplay]
ReadPrec StartReplay
Int -> ReadS StartReplay
ReadS [StartReplay]
(Int -> ReadS StartReplay)
-> ReadS [StartReplay]
-> ReadPrec StartReplay
-> ReadPrec [StartReplay]
-> Read StartReplay
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartReplay]
$creadListPrec :: ReadPrec [StartReplay]
readPrec :: ReadPrec StartReplay
$creadPrec :: ReadPrec StartReplay
readList :: ReadS [StartReplay]
$creadList :: ReadS [StartReplay]
readsPrec :: Int -> ReadS StartReplay
$creadsPrec :: Int -> ReadS StartReplay
Prelude.Read, Int -> StartReplay -> ShowS
[StartReplay] -> ShowS
StartReplay -> String
(Int -> StartReplay -> ShowS)
-> (StartReplay -> String)
-> ([StartReplay] -> ShowS)
-> Show StartReplay
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartReplay] -> ShowS
$cshowList :: [StartReplay] -> ShowS
show :: StartReplay -> String
$cshow :: StartReplay -> String
showsPrec :: Int -> StartReplay -> ShowS
$cshowsPrec :: Int -> StartReplay -> ShowS
Prelude.Show, (forall x. StartReplay -> Rep StartReplay x)
-> (forall x. Rep StartReplay x -> StartReplay)
-> Generic StartReplay
forall x. Rep StartReplay x -> StartReplay
forall x. StartReplay -> Rep StartReplay x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartReplay x -> StartReplay
$cfrom :: forall x. StartReplay -> Rep StartReplay x
Prelude.Generic)

-- |
-- Create a value of 'StartReplay' 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:
--
-- 'description', 'startReplay_description' - A description for the replay to start.
--
-- 'replayName', 'startReplay_replayName' - The name of the replay to start.
--
-- 'eventSourceArn', 'startReplay_eventSourceArn' - The ARN of the archive to replay events from.
--
-- 'eventStartTime', 'startReplay_eventStartTime' - A time stamp for the time to start replaying events. Only events that
-- occurred between the @EventStartTime@ and @EventEndTime@ are replayed.
--
-- 'eventEndTime', 'startReplay_eventEndTime' - A time stamp for the time to stop replaying events. Only events that
-- occurred between the @EventStartTime@ and @EventEndTime@ are replayed.
--
-- 'destination', 'startReplay_destination' - A @ReplayDestination@ object that includes details about the destination
-- for the replay.
newStartReplay ::
  -- | 'replayName'
  Prelude.Text ->
  -- | 'eventSourceArn'
  Prelude.Text ->
  -- | 'eventStartTime'
  Prelude.UTCTime ->
  -- | 'eventEndTime'
  Prelude.UTCTime ->
  -- | 'destination'
  ReplayDestination ->
  StartReplay
newStartReplay :: Text
-> Text -> UTCTime -> UTCTime -> ReplayDestination -> StartReplay
newStartReplay
  Text
pReplayName_
  Text
pEventSourceArn_
  UTCTime
pEventStartTime_
  UTCTime
pEventEndTime_
  ReplayDestination
pDestination_ =
    StartReplay' :: Maybe Text
-> Text
-> Text
-> POSIX
-> POSIX
-> ReplayDestination
-> StartReplay
StartReplay'
      { $sel:description:StartReplay' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:replayName:StartReplay' :: Text
replayName = Text
pReplayName_,
        $sel:eventSourceArn:StartReplay' :: Text
eventSourceArn = Text
pEventSourceArn_,
        $sel:eventStartTime:StartReplay' :: POSIX
eventStartTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventStartTime_,
        $sel:eventEndTime:StartReplay' :: POSIX
eventEndTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventEndTime_,
        $sel:destination:StartReplay' :: ReplayDestination
destination = ReplayDestination
pDestination_
      }

-- | A description for the replay to start.
startReplay_description :: Lens.Lens' StartReplay (Prelude.Maybe Prelude.Text)
startReplay_description :: (Maybe Text -> f (Maybe Text)) -> StartReplay -> f StartReplay
startReplay_description = (StartReplay -> Maybe Text)
-> (StartReplay -> Maybe Text -> StartReplay)
-> Lens StartReplay StartReplay (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplay' {Maybe Text
description :: Maybe Text
$sel:description:StartReplay' :: StartReplay -> Maybe Text
description} -> Maybe Text
description) (\s :: StartReplay
s@StartReplay' {} Maybe Text
a -> StartReplay
s {$sel:description:StartReplay' :: Maybe Text
description = Maybe Text
a} :: StartReplay)

-- | The name of the replay to start.
startReplay_replayName :: Lens.Lens' StartReplay Prelude.Text
startReplay_replayName :: (Text -> f Text) -> StartReplay -> f StartReplay
startReplay_replayName = (StartReplay -> Text)
-> (StartReplay -> Text -> StartReplay)
-> Lens StartReplay StartReplay Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplay' {Text
replayName :: Text
$sel:replayName:StartReplay' :: StartReplay -> Text
replayName} -> Text
replayName) (\s :: StartReplay
s@StartReplay' {} Text
a -> StartReplay
s {$sel:replayName:StartReplay' :: Text
replayName = Text
a} :: StartReplay)

-- | The ARN of the archive to replay events from.
startReplay_eventSourceArn :: Lens.Lens' StartReplay Prelude.Text
startReplay_eventSourceArn :: (Text -> f Text) -> StartReplay -> f StartReplay
startReplay_eventSourceArn = (StartReplay -> Text)
-> (StartReplay -> Text -> StartReplay)
-> Lens StartReplay StartReplay Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplay' {Text
eventSourceArn :: Text
$sel:eventSourceArn:StartReplay' :: StartReplay -> Text
eventSourceArn} -> Text
eventSourceArn) (\s :: StartReplay
s@StartReplay' {} Text
a -> StartReplay
s {$sel:eventSourceArn:StartReplay' :: Text
eventSourceArn = Text
a} :: StartReplay)

-- | A time stamp for the time to start replaying events. Only events that
-- occurred between the @EventStartTime@ and @EventEndTime@ are replayed.
startReplay_eventStartTime :: Lens.Lens' StartReplay Prelude.UTCTime
startReplay_eventStartTime :: (UTCTime -> f UTCTime) -> StartReplay -> f StartReplay
startReplay_eventStartTime = (StartReplay -> POSIX)
-> (StartReplay -> POSIX -> StartReplay)
-> Lens StartReplay StartReplay POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplay' {POSIX
eventStartTime :: POSIX
$sel:eventStartTime:StartReplay' :: StartReplay -> POSIX
eventStartTime} -> POSIX
eventStartTime) (\s :: StartReplay
s@StartReplay' {} POSIX
a -> StartReplay
s {$sel:eventStartTime:StartReplay' :: POSIX
eventStartTime = POSIX
a} :: StartReplay) ((POSIX -> f POSIX) -> StartReplay -> f StartReplay)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> StartReplay
-> f StartReplay
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A time stamp for the time to stop replaying events. Only events that
-- occurred between the @EventStartTime@ and @EventEndTime@ are replayed.
startReplay_eventEndTime :: Lens.Lens' StartReplay Prelude.UTCTime
startReplay_eventEndTime :: (UTCTime -> f UTCTime) -> StartReplay -> f StartReplay
startReplay_eventEndTime = (StartReplay -> POSIX)
-> (StartReplay -> POSIX -> StartReplay)
-> Lens StartReplay StartReplay POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplay' {POSIX
eventEndTime :: POSIX
$sel:eventEndTime:StartReplay' :: StartReplay -> POSIX
eventEndTime} -> POSIX
eventEndTime) (\s :: StartReplay
s@StartReplay' {} POSIX
a -> StartReplay
s {$sel:eventEndTime:StartReplay' :: POSIX
eventEndTime = POSIX
a} :: StartReplay) ((POSIX -> f POSIX) -> StartReplay -> f StartReplay)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> StartReplay
-> f StartReplay
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A @ReplayDestination@ object that includes details about the destination
-- for the replay.
startReplay_destination :: Lens.Lens' StartReplay ReplayDestination
startReplay_destination :: (ReplayDestination -> f ReplayDestination)
-> StartReplay -> f StartReplay
startReplay_destination = (StartReplay -> ReplayDestination)
-> (StartReplay -> ReplayDestination -> StartReplay)
-> Lens StartReplay StartReplay ReplayDestination ReplayDestination
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplay' {ReplayDestination
destination :: ReplayDestination
$sel:destination:StartReplay' :: StartReplay -> ReplayDestination
destination} -> ReplayDestination
destination) (\s :: StartReplay
s@StartReplay' {} ReplayDestination
a -> StartReplay
s {$sel:destination:StartReplay' :: ReplayDestination
destination = ReplayDestination
a} :: StartReplay)

instance Core.AWSRequest StartReplay where
  type AWSResponse StartReplay = StartReplayResponse
  request :: StartReplay -> Request StartReplay
request = Service -> StartReplay -> Request StartReplay
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartReplay
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartReplay)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartReplay))
-> Logger
-> Service
-> Proxy StartReplay
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartReplay)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ReplayState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> StartReplayResponse
StartReplayResponse'
            (Maybe ReplayState
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> StartReplayResponse)
-> Either String (Maybe ReplayState)
-> Either
     String
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Int -> StartReplayResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ReplayState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"State")
            Either
  String
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Int -> StartReplayResponse)
-> Either String (Maybe POSIX)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> StartReplayResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReplayStartTime")
            Either
  String (Maybe Text -> Maybe Text -> Int -> StartReplayResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> StartReplayResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReplayArn")
            Either String (Maybe Text -> Int -> StartReplayResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartReplayResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StateReason")
            Either String (Int -> StartReplayResponse)
-> Either String Int -> Either String StartReplayResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartReplay

instance Prelude.NFData StartReplay

instance Core.ToHeaders StartReplay where
  toHeaders :: StartReplay -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartReplay -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSEvents.StartReplay" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StartReplay where
  toJSON :: StartReplay -> Value
toJSON StartReplay' {Maybe Text
Text
POSIX
ReplayDestination
destination :: ReplayDestination
eventEndTime :: POSIX
eventStartTime :: POSIX
eventSourceArn :: Text
replayName :: Text
description :: Maybe Text
$sel:destination:StartReplay' :: StartReplay -> ReplayDestination
$sel:eventEndTime:StartReplay' :: StartReplay -> POSIX
$sel:eventStartTime:StartReplay' :: StartReplay -> POSIX
$sel:eventSourceArn:StartReplay' :: StartReplay -> Text
$sel:replayName:StartReplay' :: StartReplay -> Text
$sel:description:StartReplay' :: StartReplay -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ReplayName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
replayName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EventSourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventSourceArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EventStartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
eventStartTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EventEndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
eventEndTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Destination" Text -> ReplayDestination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReplayDestination
destination)
          ]
      )

instance Core.ToPath StartReplay where
  toPath :: StartReplay -> ByteString
toPath = ByteString -> StartReplay -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery StartReplay where
  toQuery :: StartReplay -> QueryString
toQuery = QueryString -> StartReplay -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartReplayResponse' smart constructor.
data StartReplayResponse = StartReplayResponse'
  { -- | The state of the replay.
    StartReplayResponse -> Maybe ReplayState
state :: Prelude.Maybe ReplayState,
    -- | The time at which the replay started.
    StartReplayResponse -> Maybe POSIX
replayStartTime :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the replay.
    StartReplayResponse -> Maybe Text
replayArn :: Prelude.Maybe Prelude.Text,
    -- | The reason that the replay is in the state.
    StartReplayResponse -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartReplayResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartReplayResponse -> StartReplayResponse -> Bool
(StartReplayResponse -> StartReplayResponse -> Bool)
-> (StartReplayResponse -> StartReplayResponse -> Bool)
-> Eq StartReplayResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartReplayResponse -> StartReplayResponse -> Bool
$c/= :: StartReplayResponse -> StartReplayResponse -> Bool
== :: StartReplayResponse -> StartReplayResponse -> Bool
$c== :: StartReplayResponse -> StartReplayResponse -> Bool
Prelude.Eq, ReadPrec [StartReplayResponse]
ReadPrec StartReplayResponse
Int -> ReadS StartReplayResponse
ReadS [StartReplayResponse]
(Int -> ReadS StartReplayResponse)
-> ReadS [StartReplayResponse]
-> ReadPrec StartReplayResponse
-> ReadPrec [StartReplayResponse]
-> Read StartReplayResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartReplayResponse]
$creadListPrec :: ReadPrec [StartReplayResponse]
readPrec :: ReadPrec StartReplayResponse
$creadPrec :: ReadPrec StartReplayResponse
readList :: ReadS [StartReplayResponse]
$creadList :: ReadS [StartReplayResponse]
readsPrec :: Int -> ReadS StartReplayResponse
$creadsPrec :: Int -> ReadS StartReplayResponse
Prelude.Read, Int -> StartReplayResponse -> ShowS
[StartReplayResponse] -> ShowS
StartReplayResponse -> String
(Int -> StartReplayResponse -> ShowS)
-> (StartReplayResponse -> String)
-> ([StartReplayResponse] -> ShowS)
-> Show StartReplayResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartReplayResponse] -> ShowS
$cshowList :: [StartReplayResponse] -> ShowS
show :: StartReplayResponse -> String
$cshow :: StartReplayResponse -> String
showsPrec :: Int -> StartReplayResponse -> ShowS
$cshowsPrec :: Int -> StartReplayResponse -> ShowS
Prelude.Show, (forall x. StartReplayResponse -> Rep StartReplayResponse x)
-> (forall x. Rep StartReplayResponse x -> StartReplayResponse)
-> Generic StartReplayResponse
forall x. Rep StartReplayResponse x -> StartReplayResponse
forall x. StartReplayResponse -> Rep StartReplayResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartReplayResponse x -> StartReplayResponse
$cfrom :: forall x. StartReplayResponse -> Rep StartReplayResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartReplayResponse' 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', 'startReplayResponse_state' - The state of the replay.
--
-- 'replayStartTime', 'startReplayResponse_replayStartTime' - The time at which the replay started.
--
-- 'replayArn', 'startReplayResponse_replayArn' - The ARN of the replay.
--
-- 'stateReason', 'startReplayResponse_stateReason' - The reason that the replay is in the state.
--
-- 'httpStatus', 'startReplayResponse_httpStatus' - The response's http status code.
newStartReplayResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartReplayResponse
newStartReplayResponse :: Int -> StartReplayResponse
newStartReplayResponse Int
pHttpStatus_ =
  StartReplayResponse' :: Maybe ReplayState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> StartReplayResponse
StartReplayResponse'
    { $sel:state:StartReplayResponse' :: Maybe ReplayState
state = Maybe ReplayState
forall a. Maybe a
Prelude.Nothing,
      $sel:replayStartTime:StartReplayResponse' :: Maybe POSIX
replayStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:replayArn:StartReplayResponse' :: Maybe Text
replayArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:StartReplayResponse' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartReplayResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The state of the replay.
startReplayResponse_state :: Lens.Lens' StartReplayResponse (Prelude.Maybe ReplayState)
startReplayResponse_state :: (Maybe ReplayState -> f (Maybe ReplayState))
-> StartReplayResponse -> f StartReplayResponse
startReplayResponse_state = (StartReplayResponse -> Maybe ReplayState)
-> (StartReplayResponse
    -> Maybe ReplayState -> StartReplayResponse)
-> Lens
     StartReplayResponse
     StartReplayResponse
     (Maybe ReplayState)
     (Maybe ReplayState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplayResponse' {Maybe ReplayState
state :: Maybe ReplayState
$sel:state:StartReplayResponse' :: StartReplayResponse -> Maybe ReplayState
state} -> Maybe ReplayState
state) (\s :: StartReplayResponse
s@StartReplayResponse' {} Maybe ReplayState
a -> StartReplayResponse
s {$sel:state:StartReplayResponse' :: Maybe ReplayState
state = Maybe ReplayState
a} :: StartReplayResponse)

-- | The time at which the replay started.
startReplayResponse_replayStartTime :: Lens.Lens' StartReplayResponse (Prelude.Maybe Prelude.UTCTime)
startReplayResponse_replayStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StartReplayResponse -> f StartReplayResponse
startReplayResponse_replayStartTime = (StartReplayResponse -> Maybe POSIX)
-> (StartReplayResponse -> Maybe POSIX -> StartReplayResponse)
-> Lens
     StartReplayResponse StartReplayResponse (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplayResponse' {Maybe POSIX
replayStartTime :: Maybe POSIX
$sel:replayStartTime:StartReplayResponse' :: StartReplayResponse -> Maybe POSIX
replayStartTime} -> Maybe POSIX
replayStartTime) (\s :: StartReplayResponse
s@StartReplayResponse' {} Maybe POSIX
a -> StartReplayResponse
s {$sel:replayStartTime:StartReplayResponse' :: Maybe POSIX
replayStartTime = Maybe POSIX
a} :: StartReplayResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> StartReplayResponse -> f StartReplayResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StartReplayResponse
-> f StartReplayResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The ARN of the replay.
startReplayResponse_replayArn :: Lens.Lens' StartReplayResponse (Prelude.Maybe Prelude.Text)
startReplayResponse_replayArn :: (Maybe Text -> f (Maybe Text))
-> StartReplayResponse -> f StartReplayResponse
startReplayResponse_replayArn = (StartReplayResponse -> Maybe Text)
-> (StartReplayResponse -> Maybe Text -> StartReplayResponse)
-> Lens
     StartReplayResponse StartReplayResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplayResponse' {Maybe Text
replayArn :: Maybe Text
$sel:replayArn:StartReplayResponse' :: StartReplayResponse -> Maybe Text
replayArn} -> Maybe Text
replayArn) (\s :: StartReplayResponse
s@StartReplayResponse' {} Maybe Text
a -> StartReplayResponse
s {$sel:replayArn:StartReplayResponse' :: Maybe Text
replayArn = Maybe Text
a} :: StartReplayResponse)

-- | The reason that the replay is in the state.
startReplayResponse_stateReason :: Lens.Lens' StartReplayResponse (Prelude.Maybe Prelude.Text)
startReplayResponse_stateReason :: (Maybe Text -> f (Maybe Text))
-> StartReplayResponse -> f StartReplayResponse
startReplayResponse_stateReason = (StartReplayResponse -> Maybe Text)
-> (StartReplayResponse -> Maybe Text -> StartReplayResponse)
-> Lens
     StartReplayResponse StartReplayResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplayResponse' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:StartReplayResponse' :: StartReplayResponse -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: StartReplayResponse
s@StartReplayResponse' {} Maybe Text
a -> StartReplayResponse
s {$sel:stateReason:StartReplayResponse' :: Maybe Text
stateReason = Maybe Text
a} :: StartReplayResponse)

-- | The response's http status code.
startReplayResponse_httpStatus :: Lens.Lens' StartReplayResponse Prelude.Int
startReplayResponse_httpStatus :: (Int -> f Int) -> StartReplayResponse -> f StartReplayResponse
startReplayResponse_httpStatus = (StartReplayResponse -> Int)
-> (StartReplayResponse -> Int -> StartReplayResponse)
-> Lens StartReplayResponse StartReplayResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplayResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartReplayResponse' :: StartReplayResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartReplayResponse
s@StartReplayResponse' {} Int
a -> StartReplayResponse
s {$sel:httpStatus:StartReplayResponse' :: Int
httpStatus = Int
a} :: StartReplayResponse)

instance Prelude.NFData StartReplayResponse