{-# 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.CloudFormation.DescribeStackEvents
-- 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)
--
-- Returns all stack related events for a specified stack in reverse
-- chronological order. For more information about a stack\'s event
-- history, go to
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/concept-stack.html Stacks>
-- in the CloudFormation User Guide.
--
-- You can list events for stacks that have failed to create or have been
-- deleted by specifying the unique stack identifier (stack ID).
--
-- This operation returns paginated results.
module Amazonka.CloudFormation.DescribeStackEvents
  ( -- * Creating a Request
    DescribeStackEvents (..),
    newDescribeStackEvents,

    -- * Request Lenses
    describeStackEvents_nextToken,
    describeStackEvents_stackName,

    -- * Destructuring the Response
    DescribeStackEventsResponse (..),
    newDescribeStackEventsResponse,

    -- * Response Lenses
    describeStackEventsResponse_nextToken,
    describeStackEventsResponse_stackEvents,
    describeStackEventsResponse_httpStatus,
  )
where

import Amazonka.CloudFormation.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

-- | The input for DescribeStackEvents action.
--
-- /See:/ 'newDescribeStackEvents' smart constructor.
data DescribeStackEvents = DescribeStackEvents'
  { -- | A string that identifies the next page of events that you want to
    -- retrieve.
    DescribeStackEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name or the unique stack ID that is associated with the stack, which
    -- are not always interchangeable:
    --
    -- -   Running stacks: You can specify either the stack\'s name or its
    --     unique stack ID.
    --
    -- -   Deleted stacks: You must specify the unique stack ID.
    --
    -- Default: There is no default value.
    DescribeStackEvents -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeStackEvents -> DescribeStackEvents -> Bool
(DescribeStackEvents -> DescribeStackEvents -> Bool)
-> (DescribeStackEvents -> DescribeStackEvents -> Bool)
-> Eq DescribeStackEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStackEvents -> DescribeStackEvents -> Bool
$c/= :: DescribeStackEvents -> DescribeStackEvents -> Bool
== :: DescribeStackEvents -> DescribeStackEvents -> Bool
$c== :: DescribeStackEvents -> DescribeStackEvents -> Bool
Prelude.Eq, ReadPrec [DescribeStackEvents]
ReadPrec DescribeStackEvents
Int -> ReadS DescribeStackEvents
ReadS [DescribeStackEvents]
(Int -> ReadS DescribeStackEvents)
-> ReadS [DescribeStackEvents]
-> ReadPrec DescribeStackEvents
-> ReadPrec [DescribeStackEvents]
-> Read DescribeStackEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStackEvents]
$creadListPrec :: ReadPrec [DescribeStackEvents]
readPrec :: ReadPrec DescribeStackEvents
$creadPrec :: ReadPrec DescribeStackEvents
readList :: ReadS [DescribeStackEvents]
$creadList :: ReadS [DescribeStackEvents]
readsPrec :: Int -> ReadS DescribeStackEvents
$creadsPrec :: Int -> ReadS DescribeStackEvents
Prelude.Read, Int -> DescribeStackEvents -> ShowS
[DescribeStackEvents] -> ShowS
DescribeStackEvents -> String
(Int -> DescribeStackEvents -> ShowS)
-> (DescribeStackEvents -> String)
-> ([DescribeStackEvents] -> ShowS)
-> Show DescribeStackEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStackEvents] -> ShowS
$cshowList :: [DescribeStackEvents] -> ShowS
show :: DescribeStackEvents -> String
$cshow :: DescribeStackEvents -> String
showsPrec :: Int -> DescribeStackEvents -> ShowS
$cshowsPrec :: Int -> DescribeStackEvents -> ShowS
Prelude.Show, (forall x. DescribeStackEvents -> Rep DescribeStackEvents x)
-> (forall x. Rep DescribeStackEvents x -> DescribeStackEvents)
-> Generic DescribeStackEvents
forall x. Rep DescribeStackEvents x -> DescribeStackEvents
forall x. DescribeStackEvents -> Rep DescribeStackEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStackEvents x -> DescribeStackEvents
$cfrom :: forall x. DescribeStackEvents -> Rep DescribeStackEvents x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStackEvents' 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:
--
-- 'nextToken', 'describeStackEvents_nextToken' - A string that identifies the next page of events that you want to
-- retrieve.
--
-- 'stackName', 'describeStackEvents_stackName' - The name or the unique stack ID that is associated with the stack, which
-- are not always interchangeable:
--
-- -   Running stacks: You can specify either the stack\'s name or its
--     unique stack ID.
--
-- -   Deleted stacks: You must specify the unique stack ID.
--
-- Default: There is no default value.
newDescribeStackEvents ::
  DescribeStackEvents
newDescribeStackEvents :: DescribeStackEvents
newDescribeStackEvents =
  DescribeStackEvents' :: Maybe Text -> Maybe Text -> DescribeStackEvents
DescribeStackEvents'
    { $sel:nextToken:DescribeStackEvents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stackName:DescribeStackEvents' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A string that identifies the next page of events that you want to
-- retrieve.
describeStackEvents_nextToken :: Lens.Lens' DescribeStackEvents (Prelude.Maybe Prelude.Text)
describeStackEvents_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeStackEvents -> f DescribeStackEvents
describeStackEvents_nextToken = (DescribeStackEvents -> Maybe Text)
-> (DescribeStackEvents -> Maybe Text -> DescribeStackEvents)
-> Lens
     DescribeStackEvents DescribeStackEvents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackEvents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeStackEvents' :: DescribeStackEvents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeStackEvents
s@DescribeStackEvents' {} Maybe Text
a -> DescribeStackEvents
s {$sel:nextToken:DescribeStackEvents' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeStackEvents)

-- | The name or the unique stack ID that is associated with the stack, which
-- are not always interchangeable:
--
-- -   Running stacks: You can specify either the stack\'s name or its
--     unique stack ID.
--
-- -   Deleted stacks: You must specify the unique stack ID.
--
-- Default: There is no default value.
describeStackEvents_stackName :: Lens.Lens' DescribeStackEvents (Prelude.Maybe Prelude.Text)
describeStackEvents_stackName :: (Maybe Text -> f (Maybe Text))
-> DescribeStackEvents -> f DescribeStackEvents
describeStackEvents_stackName = (DescribeStackEvents -> Maybe Text)
-> (DescribeStackEvents -> Maybe Text -> DescribeStackEvents)
-> Lens
     DescribeStackEvents DescribeStackEvents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackEvents' {Maybe Text
stackName :: Maybe Text
$sel:stackName:DescribeStackEvents' :: DescribeStackEvents -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: DescribeStackEvents
s@DescribeStackEvents' {} Maybe Text
a -> DescribeStackEvents
s {$sel:stackName:DescribeStackEvents' :: Maybe Text
stackName = Maybe Text
a} :: DescribeStackEvents)

instance Core.AWSPager DescribeStackEvents where
  page :: DescribeStackEvents
-> AWSResponse DescribeStackEvents -> Maybe DescribeStackEvents
page DescribeStackEvents
rq AWSResponse DescribeStackEvents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeStackEvents
DescribeStackEventsResponse
rs
            DescribeStackEventsResponse
-> Getting (First Text) DescribeStackEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeStackEventsResponse
-> Const (First Text) DescribeStackEventsResponse
Lens' DescribeStackEventsResponse (Maybe Text)
describeStackEventsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeStackEventsResponse
 -> Const (First Text) DescribeStackEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeStackEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeStackEvents
forall a. Maybe a
Prelude.Nothing
    | Maybe [StackEvent] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeStackEvents
DescribeStackEventsResponse
rs
            DescribeStackEventsResponse
-> Getting
     (First [StackEvent]) DescribeStackEventsResponse [StackEvent]
-> Maybe [StackEvent]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [StackEvent]
 -> Const (First [StackEvent]) (Maybe [StackEvent]))
-> DescribeStackEventsResponse
-> Const (First [StackEvent]) DescribeStackEventsResponse
Lens' DescribeStackEventsResponse (Maybe [StackEvent])
describeStackEventsResponse_stackEvents
              ((Maybe [StackEvent]
  -> Const (First [StackEvent]) (Maybe [StackEvent]))
 -> DescribeStackEventsResponse
 -> Const (First [StackEvent]) DescribeStackEventsResponse)
-> (([StackEvent] -> Const (First [StackEvent]) [StackEvent])
    -> Maybe [StackEvent]
    -> Const (First [StackEvent]) (Maybe [StackEvent]))
-> Getting
     (First [StackEvent]) DescribeStackEventsResponse [StackEvent]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([StackEvent] -> Const (First [StackEvent]) [StackEvent])
-> Maybe [StackEvent]
-> Const (First [StackEvent]) (Maybe [StackEvent])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeStackEvents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeStackEvents -> Maybe DescribeStackEvents
forall a. a -> Maybe a
Prelude.Just (DescribeStackEvents -> Maybe DescribeStackEvents)
-> DescribeStackEvents -> Maybe DescribeStackEvents
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeStackEvents
rq
          DescribeStackEvents
-> (DescribeStackEvents -> DescribeStackEvents)
-> DescribeStackEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeStackEvents -> Identity DescribeStackEvents
Lens
  DescribeStackEvents DescribeStackEvents (Maybe Text) (Maybe Text)
describeStackEvents_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeStackEvents -> Identity DescribeStackEvents)
-> Maybe Text -> DescribeStackEvents -> DescribeStackEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeStackEvents
DescribeStackEventsResponse
rs
          DescribeStackEventsResponse
-> Getting (First Text) DescribeStackEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeStackEventsResponse
-> Const (First Text) DescribeStackEventsResponse
Lens' DescribeStackEventsResponse (Maybe Text)
describeStackEventsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeStackEventsResponse
 -> Const (First Text) DescribeStackEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeStackEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeStackEvents where
  type
    AWSResponse DescribeStackEvents =
      DescribeStackEventsResponse
  request :: DescribeStackEvents -> Request DescribeStackEvents
request = Service -> DescribeStackEvents -> Request DescribeStackEvents
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeStackEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeStackEvents)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeStackEvents))
-> Logger
-> Service
-> Proxy DescribeStackEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeStackEvents)))
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
"DescribeStackEventsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [StackEvent] -> Int -> DescribeStackEventsResponse
DescribeStackEventsResponse'
            (Maybe Text
 -> Maybe [StackEvent] -> Int -> DescribeStackEventsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [StackEvent] -> Int -> DescribeStackEventsResponse)
forall (f :: * -> *) a b. Functor 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
"NextToken")
            Either
  String (Maybe [StackEvent] -> Int -> DescribeStackEventsResponse)
-> Either String (Maybe [StackEvent])
-> Either String (Int -> DescribeStackEventsResponse)
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
"StackEvents" 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 [StackEvent]))
-> Either String (Maybe [StackEvent])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [StackEvent])
-> [Node] -> Either String (Maybe [StackEvent])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [StackEvent]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> DescribeStackEventsResponse)
-> Either String Int -> Either String DescribeStackEventsResponse
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 DescribeStackEvents

instance Prelude.NFData DescribeStackEvents

instance Core.ToHeaders DescribeStackEvents where
  toHeaders :: DescribeStackEvents -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeStackEvents -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeStackEvents where
  toQuery :: DescribeStackEvents -> QueryString
toQuery DescribeStackEvents' {Maybe Text
stackName :: Maybe Text
nextToken :: Maybe Text
$sel:stackName:DescribeStackEvents' :: DescribeStackEvents -> Maybe Text
$sel:nextToken:DescribeStackEvents' :: DescribeStackEvents -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeStackEvents" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"StackName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
stackName
      ]

-- | The output for a DescribeStackEvents action.
--
-- /See:/ 'newDescribeStackEventsResponse' smart constructor.
data DescribeStackEventsResponse = DescribeStackEventsResponse'
  { -- | If the output exceeds 1 MB in size, a string that identifies the next
    -- page of events. If no additional page exists, this value is null.
    DescribeStackEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of @StackEvents@ structures.
    DescribeStackEventsResponse -> Maybe [StackEvent]
stackEvents :: Prelude.Maybe [StackEvent],
    -- | The response's http status code.
    DescribeStackEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeStackEventsResponse -> DescribeStackEventsResponse -> Bool
(DescribeStackEventsResponse
 -> DescribeStackEventsResponse -> Bool)
-> (DescribeStackEventsResponse
    -> DescribeStackEventsResponse -> Bool)
-> Eq DescribeStackEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStackEventsResponse -> DescribeStackEventsResponse -> Bool
$c/= :: DescribeStackEventsResponse -> DescribeStackEventsResponse -> Bool
== :: DescribeStackEventsResponse -> DescribeStackEventsResponse -> Bool
$c== :: DescribeStackEventsResponse -> DescribeStackEventsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeStackEventsResponse]
ReadPrec DescribeStackEventsResponse
Int -> ReadS DescribeStackEventsResponse
ReadS [DescribeStackEventsResponse]
(Int -> ReadS DescribeStackEventsResponse)
-> ReadS [DescribeStackEventsResponse]
-> ReadPrec DescribeStackEventsResponse
-> ReadPrec [DescribeStackEventsResponse]
-> Read DescribeStackEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStackEventsResponse]
$creadListPrec :: ReadPrec [DescribeStackEventsResponse]
readPrec :: ReadPrec DescribeStackEventsResponse
$creadPrec :: ReadPrec DescribeStackEventsResponse
readList :: ReadS [DescribeStackEventsResponse]
$creadList :: ReadS [DescribeStackEventsResponse]
readsPrec :: Int -> ReadS DescribeStackEventsResponse
$creadsPrec :: Int -> ReadS DescribeStackEventsResponse
Prelude.Read, Int -> DescribeStackEventsResponse -> ShowS
[DescribeStackEventsResponse] -> ShowS
DescribeStackEventsResponse -> String
(Int -> DescribeStackEventsResponse -> ShowS)
-> (DescribeStackEventsResponse -> String)
-> ([DescribeStackEventsResponse] -> ShowS)
-> Show DescribeStackEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStackEventsResponse] -> ShowS
$cshowList :: [DescribeStackEventsResponse] -> ShowS
show :: DescribeStackEventsResponse -> String
$cshow :: DescribeStackEventsResponse -> String
showsPrec :: Int -> DescribeStackEventsResponse -> ShowS
$cshowsPrec :: Int -> DescribeStackEventsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeStackEventsResponse -> Rep DescribeStackEventsResponse x)
-> (forall x.
    Rep DescribeStackEventsResponse x -> DescribeStackEventsResponse)
-> Generic DescribeStackEventsResponse
forall x.
Rep DescribeStackEventsResponse x -> DescribeStackEventsResponse
forall x.
DescribeStackEventsResponse -> Rep DescribeStackEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeStackEventsResponse x -> DescribeStackEventsResponse
$cfrom :: forall x.
DescribeStackEventsResponse -> Rep DescribeStackEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStackEventsResponse' 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:
--
-- 'nextToken', 'describeStackEventsResponse_nextToken' - If the output exceeds 1 MB in size, a string that identifies the next
-- page of events. If no additional page exists, this value is null.
--
-- 'stackEvents', 'describeStackEventsResponse_stackEvents' - A list of @StackEvents@ structures.
--
-- 'httpStatus', 'describeStackEventsResponse_httpStatus' - The response's http status code.
newDescribeStackEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeStackEventsResponse
newDescribeStackEventsResponse :: Int -> DescribeStackEventsResponse
newDescribeStackEventsResponse Int
pHttpStatus_ =
  DescribeStackEventsResponse' :: Maybe Text
-> Maybe [StackEvent] -> Int -> DescribeStackEventsResponse
DescribeStackEventsResponse'
    { $sel:nextToken:DescribeStackEventsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stackEvents:DescribeStackEventsResponse' :: Maybe [StackEvent]
stackEvents = Maybe [StackEvent]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeStackEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the output exceeds 1 MB in size, a string that identifies the next
-- page of events. If no additional page exists, this value is null.
describeStackEventsResponse_nextToken :: Lens.Lens' DescribeStackEventsResponse (Prelude.Maybe Prelude.Text)
describeStackEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeStackEventsResponse -> f DescribeStackEventsResponse
describeStackEventsResponse_nextToken = (DescribeStackEventsResponse -> Maybe Text)
-> (DescribeStackEventsResponse
    -> Maybe Text -> DescribeStackEventsResponse)
-> Lens' DescribeStackEventsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeStackEventsResponse' :: DescribeStackEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeStackEventsResponse
s@DescribeStackEventsResponse' {} Maybe Text
a -> DescribeStackEventsResponse
s {$sel:nextToken:DescribeStackEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeStackEventsResponse)

-- | A list of @StackEvents@ structures.
describeStackEventsResponse_stackEvents :: Lens.Lens' DescribeStackEventsResponse (Prelude.Maybe [StackEvent])
describeStackEventsResponse_stackEvents :: (Maybe [StackEvent] -> f (Maybe [StackEvent]))
-> DescribeStackEventsResponse -> f DescribeStackEventsResponse
describeStackEventsResponse_stackEvents = (DescribeStackEventsResponse -> Maybe [StackEvent])
-> (DescribeStackEventsResponse
    -> Maybe [StackEvent] -> DescribeStackEventsResponse)
-> Lens' DescribeStackEventsResponse (Maybe [StackEvent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackEventsResponse' {Maybe [StackEvent]
stackEvents :: Maybe [StackEvent]
$sel:stackEvents:DescribeStackEventsResponse' :: DescribeStackEventsResponse -> Maybe [StackEvent]
stackEvents} -> Maybe [StackEvent]
stackEvents) (\s :: DescribeStackEventsResponse
s@DescribeStackEventsResponse' {} Maybe [StackEvent]
a -> DescribeStackEventsResponse
s {$sel:stackEvents:DescribeStackEventsResponse' :: Maybe [StackEvent]
stackEvents = Maybe [StackEvent]
a} :: DescribeStackEventsResponse) ((Maybe [StackEvent] -> f (Maybe [StackEvent]))
 -> DescribeStackEventsResponse -> f DescribeStackEventsResponse)
-> ((Maybe [StackEvent] -> f (Maybe [StackEvent]))
    -> Maybe [StackEvent] -> f (Maybe [StackEvent]))
-> (Maybe [StackEvent] -> f (Maybe [StackEvent]))
-> DescribeStackEventsResponse
-> f DescribeStackEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [StackEvent] [StackEvent] [StackEvent] [StackEvent]
-> Iso
     (Maybe [StackEvent])
     (Maybe [StackEvent])
     (Maybe [StackEvent])
     (Maybe [StackEvent])
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 [StackEvent] [StackEvent] [StackEvent] [StackEvent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeStackEventsResponse