{-# 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.ElasticBeanstalk.DescribeEnvironmentManagedActionHistory
-- 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)
--
-- Lists an environment\'s completed and failed managed actions.
--
-- This operation returns paginated results.
module Amazonka.ElasticBeanstalk.DescribeEnvironmentManagedActionHistory
  ( -- * Creating a Request
    DescribeEnvironmentManagedActionHistory (..),
    newDescribeEnvironmentManagedActionHistory,

    -- * Request Lenses
    describeEnvironmentManagedActionHistory_nextToken,
    describeEnvironmentManagedActionHistory_environmentName,
    describeEnvironmentManagedActionHistory_maxItems,
    describeEnvironmentManagedActionHistory_environmentId,

    -- * Destructuring the Response
    DescribeEnvironmentManagedActionHistoryResponse (..),
    newDescribeEnvironmentManagedActionHistoryResponse,

    -- * Response Lenses
    describeEnvironmentManagedActionHistoryResponse_managedActionHistoryItems,
    describeEnvironmentManagedActionHistoryResponse_nextToken,
    describeEnvironmentManagedActionHistoryResponse_httpStatus,
  )
where

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

-- | Request to list completed and failed managed actions.
--
-- /See:/ 'newDescribeEnvironmentManagedActionHistory' smart constructor.
data DescribeEnvironmentManagedActionHistory = DescribeEnvironmentManagedActionHistory'
  { -- | The pagination token returned by a previous request.
    DescribeEnvironmentManagedActionHistory -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the target environment.
    DescribeEnvironmentManagedActionHistory -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for a single request.
    DescribeEnvironmentManagedActionHistory -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The environment ID of the target environment.
    DescribeEnvironmentManagedActionHistory -> Maybe Text
environmentId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeEnvironmentManagedActionHistory
-> DescribeEnvironmentManagedActionHistory -> Bool
(DescribeEnvironmentManagedActionHistory
 -> DescribeEnvironmentManagedActionHistory -> Bool)
-> (DescribeEnvironmentManagedActionHistory
    -> DescribeEnvironmentManagedActionHistory -> Bool)
-> Eq DescribeEnvironmentManagedActionHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEnvironmentManagedActionHistory
-> DescribeEnvironmentManagedActionHistory -> Bool
$c/= :: DescribeEnvironmentManagedActionHistory
-> DescribeEnvironmentManagedActionHistory -> Bool
== :: DescribeEnvironmentManagedActionHistory
-> DescribeEnvironmentManagedActionHistory -> Bool
$c== :: DescribeEnvironmentManagedActionHistory
-> DescribeEnvironmentManagedActionHistory -> Bool
Prelude.Eq, ReadPrec [DescribeEnvironmentManagedActionHistory]
ReadPrec DescribeEnvironmentManagedActionHistory
Int -> ReadS DescribeEnvironmentManagedActionHistory
ReadS [DescribeEnvironmentManagedActionHistory]
(Int -> ReadS DescribeEnvironmentManagedActionHistory)
-> ReadS [DescribeEnvironmentManagedActionHistory]
-> ReadPrec DescribeEnvironmentManagedActionHistory
-> ReadPrec [DescribeEnvironmentManagedActionHistory]
-> Read DescribeEnvironmentManagedActionHistory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEnvironmentManagedActionHistory]
$creadListPrec :: ReadPrec [DescribeEnvironmentManagedActionHistory]
readPrec :: ReadPrec DescribeEnvironmentManagedActionHistory
$creadPrec :: ReadPrec DescribeEnvironmentManagedActionHistory
readList :: ReadS [DescribeEnvironmentManagedActionHistory]
$creadList :: ReadS [DescribeEnvironmentManagedActionHistory]
readsPrec :: Int -> ReadS DescribeEnvironmentManagedActionHistory
$creadsPrec :: Int -> ReadS DescribeEnvironmentManagedActionHistory
Prelude.Read, Int -> DescribeEnvironmentManagedActionHistory -> ShowS
[DescribeEnvironmentManagedActionHistory] -> ShowS
DescribeEnvironmentManagedActionHistory -> String
(Int -> DescribeEnvironmentManagedActionHistory -> ShowS)
-> (DescribeEnvironmentManagedActionHistory -> String)
-> ([DescribeEnvironmentManagedActionHistory] -> ShowS)
-> Show DescribeEnvironmentManagedActionHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEnvironmentManagedActionHistory] -> ShowS
$cshowList :: [DescribeEnvironmentManagedActionHistory] -> ShowS
show :: DescribeEnvironmentManagedActionHistory -> String
$cshow :: DescribeEnvironmentManagedActionHistory -> String
showsPrec :: Int -> DescribeEnvironmentManagedActionHistory -> ShowS
$cshowsPrec :: Int -> DescribeEnvironmentManagedActionHistory -> ShowS
Prelude.Show, (forall x.
 DescribeEnvironmentManagedActionHistory
 -> Rep DescribeEnvironmentManagedActionHistory x)
-> (forall x.
    Rep DescribeEnvironmentManagedActionHistory x
    -> DescribeEnvironmentManagedActionHistory)
-> Generic DescribeEnvironmentManagedActionHistory
forall x.
Rep DescribeEnvironmentManagedActionHistory x
-> DescribeEnvironmentManagedActionHistory
forall x.
DescribeEnvironmentManagedActionHistory
-> Rep DescribeEnvironmentManagedActionHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEnvironmentManagedActionHistory x
-> DescribeEnvironmentManagedActionHistory
$cfrom :: forall x.
DescribeEnvironmentManagedActionHistory
-> Rep DescribeEnvironmentManagedActionHistory x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEnvironmentManagedActionHistory' 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', 'describeEnvironmentManagedActionHistory_nextToken' - The pagination token returned by a previous request.
--
-- 'environmentName', 'describeEnvironmentManagedActionHistory_environmentName' - The name of the target environment.
--
-- 'maxItems', 'describeEnvironmentManagedActionHistory_maxItems' - The maximum number of items to return for a single request.
--
-- 'environmentId', 'describeEnvironmentManagedActionHistory_environmentId' - The environment ID of the target environment.
newDescribeEnvironmentManagedActionHistory ::
  DescribeEnvironmentManagedActionHistory
newDescribeEnvironmentManagedActionHistory :: DescribeEnvironmentManagedActionHistory
newDescribeEnvironmentManagedActionHistory =
  DescribeEnvironmentManagedActionHistory' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> DescribeEnvironmentManagedActionHistory
DescribeEnvironmentManagedActionHistory'
    { $sel:nextToken:DescribeEnvironmentManagedActionHistory' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentName:DescribeEnvironmentManagedActionHistory' :: Maybe Text
environmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:DescribeEnvironmentManagedActionHistory' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentId:DescribeEnvironmentManagedActionHistory' :: Maybe Text
environmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The pagination token returned by a previous request.
describeEnvironmentManagedActionHistory_nextToken :: Lens.Lens' DescribeEnvironmentManagedActionHistory (Prelude.Maybe Prelude.Text)
describeEnvironmentManagedActionHistory_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentManagedActionHistory
-> f DescribeEnvironmentManagedActionHistory
describeEnvironmentManagedActionHistory_nextToken = (DescribeEnvironmentManagedActionHistory -> Maybe Text)
-> (DescribeEnvironmentManagedActionHistory
    -> Maybe Text -> DescribeEnvironmentManagedActionHistory)
-> Lens
     DescribeEnvironmentManagedActionHistory
     DescribeEnvironmentManagedActionHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentManagedActionHistory' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEnvironmentManagedActionHistory
s@DescribeEnvironmentManagedActionHistory' {} Maybe Text
a -> DescribeEnvironmentManagedActionHistory
s {$sel:nextToken:DescribeEnvironmentManagedActionHistory' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEnvironmentManagedActionHistory)

-- | The name of the target environment.
describeEnvironmentManagedActionHistory_environmentName :: Lens.Lens' DescribeEnvironmentManagedActionHistory (Prelude.Maybe Prelude.Text)
describeEnvironmentManagedActionHistory_environmentName :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentManagedActionHistory
-> f DescribeEnvironmentManagedActionHistory
describeEnvironmentManagedActionHistory_environmentName = (DescribeEnvironmentManagedActionHistory -> Maybe Text)
-> (DescribeEnvironmentManagedActionHistory
    -> Maybe Text -> DescribeEnvironmentManagedActionHistory)
-> Lens
     DescribeEnvironmentManagedActionHistory
     DescribeEnvironmentManagedActionHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentManagedActionHistory' {Maybe Text
environmentName :: Maybe Text
$sel:environmentName:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Text
environmentName} -> Maybe Text
environmentName) (\s :: DescribeEnvironmentManagedActionHistory
s@DescribeEnvironmentManagedActionHistory' {} Maybe Text
a -> DescribeEnvironmentManagedActionHistory
s {$sel:environmentName:DescribeEnvironmentManagedActionHistory' :: Maybe Text
environmentName = Maybe Text
a} :: DescribeEnvironmentManagedActionHistory)

-- | The maximum number of items to return for a single request.
describeEnvironmentManagedActionHistory_maxItems :: Lens.Lens' DescribeEnvironmentManagedActionHistory (Prelude.Maybe Prelude.Natural)
describeEnvironmentManagedActionHistory_maxItems :: (Maybe Natural -> f (Maybe Natural))
-> DescribeEnvironmentManagedActionHistory
-> f DescribeEnvironmentManagedActionHistory
describeEnvironmentManagedActionHistory_maxItems = (DescribeEnvironmentManagedActionHistory -> Maybe Natural)
-> (DescribeEnvironmentManagedActionHistory
    -> Maybe Natural -> DescribeEnvironmentManagedActionHistory)
-> Lens
     DescribeEnvironmentManagedActionHistory
     DescribeEnvironmentManagedActionHistory
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentManagedActionHistory' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: DescribeEnvironmentManagedActionHistory
s@DescribeEnvironmentManagedActionHistory' {} Maybe Natural
a -> DescribeEnvironmentManagedActionHistory
s {$sel:maxItems:DescribeEnvironmentManagedActionHistory' :: Maybe Natural
maxItems = Maybe Natural
a} :: DescribeEnvironmentManagedActionHistory)

-- | The environment ID of the target environment.
describeEnvironmentManagedActionHistory_environmentId :: Lens.Lens' DescribeEnvironmentManagedActionHistory (Prelude.Maybe Prelude.Text)
describeEnvironmentManagedActionHistory_environmentId :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentManagedActionHistory
-> f DescribeEnvironmentManagedActionHistory
describeEnvironmentManagedActionHistory_environmentId = (DescribeEnvironmentManagedActionHistory -> Maybe Text)
-> (DescribeEnvironmentManagedActionHistory
    -> Maybe Text -> DescribeEnvironmentManagedActionHistory)
-> Lens
     DescribeEnvironmentManagedActionHistory
     DescribeEnvironmentManagedActionHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentManagedActionHistory' {Maybe Text
environmentId :: Maybe Text
$sel:environmentId:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Text
environmentId} -> Maybe Text
environmentId) (\s :: DescribeEnvironmentManagedActionHistory
s@DescribeEnvironmentManagedActionHistory' {} Maybe Text
a -> DescribeEnvironmentManagedActionHistory
s {$sel:environmentId:DescribeEnvironmentManagedActionHistory' :: Maybe Text
environmentId = Maybe Text
a} :: DescribeEnvironmentManagedActionHistory)

instance
  Core.AWSPager
    DescribeEnvironmentManagedActionHistory
  where
  page :: DescribeEnvironmentManagedActionHistory
-> AWSResponse DescribeEnvironmentManagedActionHistory
-> Maybe DescribeEnvironmentManagedActionHistory
page DescribeEnvironmentManagedActionHistory
rq AWSResponse DescribeEnvironmentManagedActionHistory
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEnvironmentManagedActionHistory
DescribeEnvironmentManagedActionHistoryResponse
rs
            DescribeEnvironmentManagedActionHistoryResponse
-> Getting
     (First Text) DescribeEnvironmentManagedActionHistoryResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeEnvironmentManagedActionHistoryResponse
-> Const
     (First Text) DescribeEnvironmentManagedActionHistoryResponse
Lens' DescribeEnvironmentManagedActionHistoryResponse (Maybe Text)
describeEnvironmentManagedActionHistoryResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeEnvironmentManagedActionHistoryResponse
 -> Const
      (First Text) DescribeEnvironmentManagedActionHistoryResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeEnvironmentManagedActionHistoryResponse 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 DescribeEnvironmentManagedActionHistory
forall a. Maybe a
Prelude.Nothing
    | Maybe [ManagedActionHistoryItem] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEnvironmentManagedActionHistory
DescribeEnvironmentManagedActionHistoryResponse
rs
            DescribeEnvironmentManagedActionHistoryResponse
-> Getting
     (First [ManagedActionHistoryItem])
     DescribeEnvironmentManagedActionHistoryResponse
     [ManagedActionHistoryItem]
-> Maybe [ManagedActionHistoryItem]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty ManagedActionHistoryItem)
 -> Const
      (First [ManagedActionHistoryItem])
      (Maybe (NonEmpty ManagedActionHistoryItem)))
-> DescribeEnvironmentManagedActionHistoryResponse
-> Const
     (First [ManagedActionHistoryItem])
     DescribeEnvironmentManagedActionHistoryResponse
Lens'
  DescribeEnvironmentManagedActionHistoryResponse
  (Maybe (NonEmpty ManagedActionHistoryItem))
describeEnvironmentManagedActionHistoryResponse_managedActionHistoryItems
              ((Maybe (NonEmpty ManagedActionHistoryItem)
  -> Const
       (First [ManagedActionHistoryItem])
       (Maybe (NonEmpty ManagedActionHistoryItem)))
 -> DescribeEnvironmentManagedActionHistoryResponse
 -> Const
      (First [ManagedActionHistoryItem])
      DescribeEnvironmentManagedActionHistoryResponse)
-> (([ManagedActionHistoryItem]
     -> Const
          (First [ManagedActionHistoryItem]) [ManagedActionHistoryItem])
    -> Maybe (NonEmpty ManagedActionHistoryItem)
    -> Const
         (First [ManagedActionHistoryItem])
         (Maybe (NonEmpty ManagedActionHistoryItem)))
-> Getting
     (First [ManagedActionHistoryItem])
     DescribeEnvironmentManagedActionHistoryResponse
     [ManagedActionHistoryItem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ManagedActionHistoryItem
 -> Const
      (First [ManagedActionHistoryItem])
      (NonEmpty ManagedActionHistoryItem))
-> Maybe (NonEmpty ManagedActionHistoryItem)
-> Const
     (First [ManagedActionHistoryItem])
     (Maybe (NonEmpty ManagedActionHistoryItem))
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((NonEmpty ManagedActionHistoryItem
  -> Const
       (First [ManagedActionHistoryItem])
       (NonEmpty ManagedActionHistoryItem))
 -> Maybe (NonEmpty ManagedActionHistoryItem)
 -> Const
      (First [ManagedActionHistoryItem])
      (Maybe (NonEmpty ManagedActionHistoryItem)))
-> (([ManagedActionHistoryItem]
     -> Const
          (First [ManagedActionHistoryItem]) [ManagedActionHistoryItem])
    -> NonEmpty ManagedActionHistoryItem
    -> Const
         (First [ManagedActionHistoryItem])
         (NonEmpty ManagedActionHistoryItem))
-> ([ManagedActionHistoryItem]
    -> Const
         (First [ManagedActionHistoryItem]) [ManagedActionHistoryItem])
-> Maybe (NonEmpty ManagedActionHistoryItem)
-> Const
     (First [ManagedActionHistoryItem])
     (Maybe (NonEmpty ManagedActionHistoryItem))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ManagedActionHistoryItem -> [ManagedActionHistoryItem])
-> ([ManagedActionHistoryItem]
    -> Const
         (First [ManagedActionHistoryItem]) [ManagedActionHistoryItem])
-> NonEmpty ManagedActionHistoryItem
-> Const
     (First [ManagedActionHistoryItem])
     (NonEmpty ManagedActionHistoryItem)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty ManagedActionHistoryItem -> [ManagedActionHistoryItem]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe DescribeEnvironmentManagedActionHistory
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeEnvironmentManagedActionHistory
-> Maybe DescribeEnvironmentManagedActionHistory
forall a. a -> Maybe a
Prelude.Just (DescribeEnvironmentManagedActionHistory
 -> Maybe DescribeEnvironmentManagedActionHistory)
-> DescribeEnvironmentManagedActionHistory
-> Maybe DescribeEnvironmentManagedActionHistory
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeEnvironmentManagedActionHistory
rq
          DescribeEnvironmentManagedActionHistory
-> (DescribeEnvironmentManagedActionHistory
    -> DescribeEnvironmentManagedActionHistory)
-> DescribeEnvironmentManagedActionHistory
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeEnvironmentManagedActionHistory
-> Identity DescribeEnvironmentManagedActionHistory
Lens
  DescribeEnvironmentManagedActionHistory
  DescribeEnvironmentManagedActionHistory
  (Maybe Text)
  (Maybe Text)
describeEnvironmentManagedActionHistory_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeEnvironmentManagedActionHistory
 -> Identity DescribeEnvironmentManagedActionHistory)
-> Maybe Text
-> DescribeEnvironmentManagedActionHistory
-> DescribeEnvironmentManagedActionHistory
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeEnvironmentManagedActionHistory
DescribeEnvironmentManagedActionHistoryResponse
rs
            DescribeEnvironmentManagedActionHistoryResponse
-> Getting
     (First Text) DescribeEnvironmentManagedActionHistoryResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeEnvironmentManagedActionHistoryResponse
-> Const
     (First Text) DescribeEnvironmentManagedActionHistoryResponse
Lens' DescribeEnvironmentManagedActionHistoryResponse (Maybe Text)
describeEnvironmentManagedActionHistoryResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeEnvironmentManagedActionHistoryResponse
 -> Const
      (First Text) DescribeEnvironmentManagedActionHistoryResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeEnvironmentManagedActionHistoryResponse 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
    DescribeEnvironmentManagedActionHistory
  where
  type
    AWSResponse
      DescribeEnvironmentManagedActionHistory =
      DescribeEnvironmentManagedActionHistoryResponse
  request :: DescribeEnvironmentManagedActionHistory
-> Request DescribeEnvironmentManagedActionHistory
request = Service
-> DescribeEnvironmentManagedActionHistory
-> Request DescribeEnvironmentManagedActionHistory
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEnvironmentManagedActionHistory
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeEnvironmentManagedActionHistory)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either
         String (AWSResponse DescribeEnvironmentManagedActionHistory))
-> Logger
-> Service
-> Proxy DescribeEnvironmentManagedActionHistory
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeEnvironmentManagedActionHistory)))
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
"DescribeEnvironmentManagedActionHistoryResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe (NonEmpty ManagedActionHistoryItem)
-> Maybe Text
-> Int
-> DescribeEnvironmentManagedActionHistoryResponse
DescribeEnvironmentManagedActionHistoryResponse'
            (Maybe (NonEmpty ManagedActionHistoryItem)
 -> Maybe Text
 -> Int
 -> DescribeEnvironmentManagedActionHistoryResponse)
-> Either String (Maybe (NonEmpty ManagedActionHistoryItem))
-> Either
     String
     (Maybe Text
      -> Int -> DescribeEnvironmentManagedActionHistoryResponse)
forall (f :: * -> *) a b. Functor 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
"ManagedActionHistoryItems"
                            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 (NonEmpty ManagedActionHistoryItem)))
-> Either String (Maybe (NonEmpty ManagedActionHistoryItem))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String (NonEmpty ManagedActionHistoryItem))
-> [Node]
-> Either String (Maybe (NonEmpty ManagedActionHistoryItem))
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String (NonEmpty ManagedActionHistoryItem)
forall a. FromXML a => Text -> [Node] -> Either String (NonEmpty a)
Core.parseXMLList1 Text
"member")
                        )
              Either
  String
  (Maybe Text
   -> Int -> DescribeEnvironmentManagedActionHistoryResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> DescribeEnvironmentManagedActionHistoryResponse)
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
"NextToken")
              Either
  String (Int -> DescribeEnvironmentManagedActionHistoryResponse)
-> Either String Int
-> Either String DescribeEnvironmentManagedActionHistoryResponse
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
    DescribeEnvironmentManagedActionHistory

instance
  Prelude.NFData
    DescribeEnvironmentManagedActionHistory

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

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

instance
  Core.ToQuery
    DescribeEnvironmentManagedActionHistory
  where
  toQuery :: DescribeEnvironmentManagedActionHistory -> QueryString
toQuery DescribeEnvironmentManagedActionHistory' {Maybe Natural
Maybe Text
environmentId :: Maybe Text
maxItems :: Maybe Natural
environmentName :: Maybe Text
nextToken :: Maybe Text
$sel:environmentId:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Text
$sel:maxItems:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Natural
$sel:environmentName:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> Maybe Text
$sel:nextToken:DescribeEnvironmentManagedActionHistory' :: DescribeEnvironmentManagedActionHistory -> 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
"DescribeEnvironmentManagedActionHistory" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"EnvironmentName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
environmentName,
        ByteString
"MaxItems" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxItems,
        ByteString
"EnvironmentId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
environmentId
      ]

-- | A result message containing a list of completed and failed managed
-- actions.
--
-- /See:/ 'newDescribeEnvironmentManagedActionHistoryResponse' smart constructor.
data DescribeEnvironmentManagedActionHistoryResponse = DescribeEnvironmentManagedActionHistoryResponse'
  { -- | A list of completed and failed managed actions.
    DescribeEnvironmentManagedActionHistoryResponse
-> Maybe (NonEmpty ManagedActionHistoryItem)
managedActionHistoryItems :: Prelude.Maybe (Prelude.NonEmpty ManagedActionHistoryItem),
    -- | A pagination token that you pass to
    -- DescribeEnvironmentManagedActionHistory to get the next page of results.
    DescribeEnvironmentManagedActionHistoryResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeEnvironmentManagedActionHistoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEnvironmentManagedActionHistoryResponse
-> DescribeEnvironmentManagedActionHistoryResponse -> Bool
(DescribeEnvironmentManagedActionHistoryResponse
 -> DescribeEnvironmentManagedActionHistoryResponse -> Bool)
-> (DescribeEnvironmentManagedActionHistoryResponse
    -> DescribeEnvironmentManagedActionHistoryResponse -> Bool)
-> Eq DescribeEnvironmentManagedActionHistoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEnvironmentManagedActionHistoryResponse
-> DescribeEnvironmentManagedActionHistoryResponse -> Bool
$c/= :: DescribeEnvironmentManagedActionHistoryResponse
-> DescribeEnvironmentManagedActionHistoryResponse -> Bool
== :: DescribeEnvironmentManagedActionHistoryResponse
-> DescribeEnvironmentManagedActionHistoryResponse -> Bool
$c== :: DescribeEnvironmentManagedActionHistoryResponse
-> DescribeEnvironmentManagedActionHistoryResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEnvironmentManagedActionHistoryResponse]
ReadPrec DescribeEnvironmentManagedActionHistoryResponse
Int -> ReadS DescribeEnvironmentManagedActionHistoryResponse
ReadS [DescribeEnvironmentManagedActionHistoryResponse]
(Int -> ReadS DescribeEnvironmentManagedActionHistoryResponse)
-> ReadS [DescribeEnvironmentManagedActionHistoryResponse]
-> ReadPrec DescribeEnvironmentManagedActionHistoryResponse
-> ReadPrec [DescribeEnvironmentManagedActionHistoryResponse]
-> Read DescribeEnvironmentManagedActionHistoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEnvironmentManagedActionHistoryResponse]
$creadListPrec :: ReadPrec [DescribeEnvironmentManagedActionHistoryResponse]
readPrec :: ReadPrec DescribeEnvironmentManagedActionHistoryResponse
$creadPrec :: ReadPrec DescribeEnvironmentManagedActionHistoryResponse
readList :: ReadS [DescribeEnvironmentManagedActionHistoryResponse]
$creadList :: ReadS [DescribeEnvironmentManagedActionHistoryResponse]
readsPrec :: Int -> ReadS DescribeEnvironmentManagedActionHistoryResponse
$creadsPrec :: Int -> ReadS DescribeEnvironmentManagedActionHistoryResponse
Prelude.Read, Int -> DescribeEnvironmentManagedActionHistoryResponse -> ShowS
[DescribeEnvironmentManagedActionHistoryResponse] -> ShowS
DescribeEnvironmentManagedActionHistoryResponse -> String
(Int -> DescribeEnvironmentManagedActionHistoryResponse -> ShowS)
-> (DescribeEnvironmentManagedActionHistoryResponse -> String)
-> ([DescribeEnvironmentManagedActionHistoryResponse] -> ShowS)
-> Show DescribeEnvironmentManagedActionHistoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEnvironmentManagedActionHistoryResponse] -> ShowS
$cshowList :: [DescribeEnvironmentManagedActionHistoryResponse] -> ShowS
show :: DescribeEnvironmentManagedActionHistoryResponse -> String
$cshow :: DescribeEnvironmentManagedActionHistoryResponse -> String
showsPrec :: Int -> DescribeEnvironmentManagedActionHistoryResponse -> ShowS
$cshowsPrec :: Int -> DescribeEnvironmentManagedActionHistoryResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEnvironmentManagedActionHistoryResponse
 -> Rep DescribeEnvironmentManagedActionHistoryResponse x)
-> (forall x.
    Rep DescribeEnvironmentManagedActionHistoryResponse x
    -> DescribeEnvironmentManagedActionHistoryResponse)
-> Generic DescribeEnvironmentManagedActionHistoryResponse
forall x.
Rep DescribeEnvironmentManagedActionHistoryResponse x
-> DescribeEnvironmentManagedActionHistoryResponse
forall x.
DescribeEnvironmentManagedActionHistoryResponse
-> Rep DescribeEnvironmentManagedActionHistoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEnvironmentManagedActionHistoryResponse x
-> DescribeEnvironmentManagedActionHistoryResponse
$cfrom :: forall x.
DescribeEnvironmentManagedActionHistoryResponse
-> Rep DescribeEnvironmentManagedActionHistoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEnvironmentManagedActionHistoryResponse' 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:
--
-- 'managedActionHistoryItems', 'describeEnvironmentManagedActionHistoryResponse_managedActionHistoryItems' - A list of completed and failed managed actions.
--
-- 'nextToken', 'describeEnvironmentManagedActionHistoryResponse_nextToken' - A pagination token that you pass to
-- DescribeEnvironmentManagedActionHistory to get the next page of results.
--
-- 'httpStatus', 'describeEnvironmentManagedActionHistoryResponse_httpStatus' - The response's http status code.
newDescribeEnvironmentManagedActionHistoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEnvironmentManagedActionHistoryResponse
newDescribeEnvironmentManagedActionHistoryResponse :: Int -> DescribeEnvironmentManagedActionHistoryResponse
newDescribeEnvironmentManagedActionHistoryResponse
  Int
pHttpStatus_ =
    DescribeEnvironmentManagedActionHistoryResponse' :: Maybe (NonEmpty ManagedActionHistoryItem)
-> Maybe Text
-> Int
-> DescribeEnvironmentManagedActionHistoryResponse
DescribeEnvironmentManagedActionHistoryResponse'
      { $sel:managedActionHistoryItems:DescribeEnvironmentManagedActionHistoryResponse' :: Maybe (NonEmpty ManagedActionHistoryItem)
managedActionHistoryItems =
          Maybe (NonEmpty ManagedActionHistoryItem)
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeEnvironmentManagedActionHistoryResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeEnvironmentManagedActionHistoryResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A list of completed and failed managed actions.
describeEnvironmentManagedActionHistoryResponse_managedActionHistoryItems :: Lens.Lens' DescribeEnvironmentManagedActionHistoryResponse (Prelude.Maybe (Prelude.NonEmpty ManagedActionHistoryItem))
describeEnvironmentManagedActionHistoryResponse_managedActionHistoryItems :: (Maybe (NonEmpty ManagedActionHistoryItem)
 -> f (Maybe (NonEmpty ManagedActionHistoryItem)))
-> DescribeEnvironmentManagedActionHistoryResponse
-> f DescribeEnvironmentManagedActionHistoryResponse
describeEnvironmentManagedActionHistoryResponse_managedActionHistoryItems = (DescribeEnvironmentManagedActionHistoryResponse
 -> Maybe (NonEmpty ManagedActionHistoryItem))
-> (DescribeEnvironmentManagedActionHistoryResponse
    -> Maybe (NonEmpty ManagedActionHistoryItem)
    -> DescribeEnvironmentManagedActionHistoryResponse)
-> Lens'
     DescribeEnvironmentManagedActionHistoryResponse
     (Maybe (NonEmpty ManagedActionHistoryItem))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentManagedActionHistoryResponse' {Maybe (NonEmpty ManagedActionHistoryItem)
managedActionHistoryItems :: Maybe (NonEmpty ManagedActionHistoryItem)
$sel:managedActionHistoryItems:DescribeEnvironmentManagedActionHistoryResponse' :: DescribeEnvironmentManagedActionHistoryResponse
-> Maybe (NonEmpty ManagedActionHistoryItem)
managedActionHistoryItems} -> Maybe (NonEmpty ManagedActionHistoryItem)
managedActionHistoryItems) (\s :: DescribeEnvironmentManagedActionHistoryResponse
s@DescribeEnvironmentManagedActionHistoryResponse' {} Maybe (NonEmpty ManagedActionHistoryItem)
a -> DescribeEnvironmentManagedActionHistoryResponse
s {$sel:managedActionHistoryItems:DescribeEnvironmentManagedActionHistoryResponse' :: Maybe (NonEmpty ManagedActionHistoryItem)
managedActionHistoryItems = Maybe (NonEmpty ManagedActionHistoryItem)
a} :: DescribeEnvironmentManagedActionHistoryResponse) ((Maybe (NonEmpty ManagedActionHistoryItem)
  -> f (Maybe (NonEmpty ManagedActionHistoryItem)))
 -> DescribeEnvironmentManagedActionHistoryResponse
 -> f DescribeEnvironmentManagedActionHistoryResponse)
-> ((Maybe (NonEmpty ManagedActionHistoryItem)
     -> f (Maybe (NonEmpty ManagedActionHistoryItem)))
    -> Maybe (NonEmpty ManagedActionHistoryItem)
    -> f (Maybe (NonEmpty ManagedActionHistoryItem)))
-> (Maybe (NonEmpty ManagedActionHistoryItem)
    -> f (Maybe (NonEmpty ManagedActionHistoryItem)))
-> DescribeEnvironmentManagedActionHistoryResponse
-> f DescribeEnvironmentManagedActionHistoryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ManagedActionHistoryItem)
  (NonEmpty ManagedActionHistoryItem)
  (NonEmpty ManagedActionHistoryItem)
  (NonEmpty ManagedActionHistoryItem)
-> Iso
     (Maybe (NonEmpty ManagedActionHistoryItem))
     (Maybe (NonEmpty ManagedActionHistoryItem))
     (Maybe (NonEmpty ManagedActionHistoryItem))
     (Maybe (NonEmpty ManagedActionHistoryItem))
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
  (NonEmpty ManagedActionHistoryItem)
  (NonEmpty ManagedActionHistoryItem)
  (NonEmpty ManagedActionHistoryItem)
  (NonEmpty ManagedActionHistoryItem)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A pagination token that you pass to
-- DescribeEnvironmentManagedActionHistory to get the next page of results.
describeEnvironmentManagedActionHistoryResponse_nextToken :: Lens.Lens' DescribeEnvironmentManagedActionHistoryResponse (Prelude.Maybe Prelude.Text)
describeEnvironmentManagedActionHistoryResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentManagedActionHistoryResponse
-> f DescribeEnvironmentManagedActionHistoryResponse
describeEnvironmentManagedActionHistoryResponse_nextToken = (DescribeEnvironmentManagedActionHistoryResponse -> Maybe Text)
-> (DescribeEnvironmentManagedActionHistoryResponse
    -> Maybe Text -> DescribeEnvironmentManagedActionHistoryResponse)
-> Lens'
     DescribeEnvironmentManagedActionHistoryResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentManagedActionHistoryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEnvironmentManagedActionHistoryResponse' :: DescribeEnvironmentManagedActionHistoryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEnvironmentManagedActionHistoryResponse
s@DescribeEnvironmentManagedActionHistoryResponse' {} Maybe Text
a -> DescribeEnvironmentManagedActionHistoryResponse
s {$sel:nextToken:DescribeEnvironmentManagedActionHistoryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEnvironmentManagedActionHistoryResponse)

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

instance
  Prelude.NFData
    DescribeEnvironmentManagedActionHistoryResponse