{-# 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.Config.DescribeRemediationExecutionStatus
-- 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)
--
-- Provides a detailed view of a Remediation Execution for a set of
-- resources including state, timestamps for when steps for the remediation
-- execution occur, and any error messages for steps that have failed. When
-- you specify the limit and the next token, you receive a paginated
-- response.
--
-- This operation returns paginated results.
module Amazonka.Config.DescribeRemediationExecutionStatus
  ( -- * Creating a Request
    DescribeRemediationExecutionStatus (..),
    newDescribeRemediationExecutionStatus,

    -- * Request Lenses
    describeRemediationExecutionStatus_nextToken,
    describeRemediationExecutionStatus_limit,
    describeRemediationExecutionStatus_resourceKeys,
    describeRemediationExecutionStatus_configRuleName,

    -- * Destructuring the Response
    DescribeRemediationExecutionStatusResponse (..),
    newDescribeRemediationExecutionStatusResponse,

    -- * Response Lenses
    describeRemediationExecutionStatusResponse_remediationExecutionStatuses,
    describeRemediationExecutionStatusResponse_nextToken,
    describeRemediationExecutionStatusResponse_httpStatus,
  )
where

import Amazonka.Config.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:/ 'newDescribeRemediationExecutionStatus' smart constructor.
data DescribeRemediationExecutionStatus = DescribeRemediationExecutionStatus'
  { -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    DescribeRemediationExecutionStatus -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of RemediationExecutionStatuses returned on each
    -- page. The default is maximum. If you specify 0, Config uses the default.
    DescribeRemediationExecutionStatus -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | A list of resource keys to be processed with the current request. Each
    -- element in the list consists of the resource type and resource ID.
    DescribeRemediationExecutionStatus -> Maybe (NonEmpty ResourceKey)
resourceKeys :: Prelude.Maybe (Prelude.NonEmpty ResourceKey),
    -- | A list of Config rule names.
    DescribeRemediationExecutionStatus -> Text
configRuleName :: Prelude.Text
  }
  deriving (DescribeRemediationExecutionStatus
-> DescribeRemediationExecutionStatus -> Bool
(DescribeRemediationExecutionStatus
 -> DescribeRemediationExecutionStatus -> Bool)
-> (DescribeRemediationExecutionStatus
    -> DescribeRemediationExecutionStatus -> Bool)
-> Eq DescribeRemediationExecutionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRemediationExecutionStatus
-> DescribeRemediationExecutionStatus -> Bool
$c/= :: DescribeRemediationExecutionStatus
-> DescribeRemediationExecutionStatus -> Bool
== :: DescribeRemediationExecutionStatus
-> DescribeRemediationExecutionStatus -> Bool
$c== :: DescribeRemediationExecutionStatus
-> DescribeRemediationExecutionStatus -> Bool
Prelude.Eq, ReadPrec [DescribeRemediationExecutionStatus]
ReadPrec DescribeRemediationExecutionStatus
Int -> ReadS DescribeRemediationExecutionStatus
ReadS [DescribeRemediationExecutionStatus]
(Int -> ReadS DescribeRemediationExecutionStatus)
-> ReadS [DescribeRemediationExecutionStatus]
-> ReadPrec DescribeRemediationExecutionStatus
-> ReadPrec [DescribeRemediationExecutionStatus]
-> Read DescribeRemediationExecutionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRemediationExecutionStatus]
$creadListPrec :: ReadPrec [DescribeRemediationExecutionStatus]
readPrec :: ReadPrec DescribeRemediationExecutionStatus
$creadPrec :: ReadPrec DescribeRemediationExecutionStatus
readList :: ReadS [DescribeRemediationExecutionStatus]
$creadList :: ReadS [DescribeRemediationExecutionStatus]
readsPrec :: Int -> ReadS DescribeRemediationExecutionStatus
$creadsPrec :: Int -> ReadS DescribeRemediationExecutionStatus
Prelude.Read, Int -> DescribeRemediationExecutionStatus -> ShowS
[DescribeRemediationExecutionStatus] -> ShowS
DescribeRemediationExecutionStatus -> String
(Int -> DescribeRemediationExecutionStatus -> ShowS)
-> (DescribeRemediationExecutionStatus -> String)
-> ([DescribeRemediationExecutionStatus] -> ShowS)
-> Show DescribeRemediationExecutionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRemediationExecutionStatus] -> ShowS
$cshowList :: [DescribeRemediationExecutionStatus] -> ShowS
show :: DescribeRemediationExecutionStatus -> String
$cshow :: DescribeRemediationExecutionStatus -> String
showsPrec :: Int -> DescribeRemediationExecutionStatus -> ShowS
$cshowsPrec :: Int -> DescribeRemediationExecutionStatus -> ShowS
Prelude.Show, (forall x.
 DescribeRemediationExecutionStatus
 -> Rep DescribeRemediationExecutionStatus x)
-> (forall x.
    Rep DescribeRemediationExecutionStatus x
    -> DescribeRemediationExecutionStatus)
-> Generic DescribeRemediationExecutionStatus
forall x.
Rep DescribeRemediationExecutionStatus x
-> DescribeRemediationExecutionStatus
forall x.
DescribeRemediationExecutionStatus
-> Rep DescribeRemediationExecutionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRemediationExecutionStatus x
-> DescribeRemediationExecutionStatus
$cfrom :: forall x.
DescribeRemediationExecutionStatus
-> Rep DescribeRemediationExecutionStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRemediationExecutionStatus' 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', 'describeRemediationExecutionStatus_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'describeRemediationExecutionStatus_limit' - The maximum number of RemediationExecutionStatuses returned on each
-- page. The default is maximum. If you specify 0, Config uses the default.
--
-- 'resourceKeys', 'describeRemediationExecutionStatus_resourceKeys' - A list of resource keys to be processed with the current request. Each
-- element in the list consists of the resource type and resource ID.
--
-- 'configRuleName', 'describeRemediationExecutionStatus_configRuleName' - A list of Config rule names.
newDescribeRemediationExecutionStatus ::
  -- | 'configRuleName'
  Prelude.Text ->
  DescribeRemediationExecutionStatus
newDescribeRemediationExecutionStatus :: Text -> DescribeRemediationExecutionStatus
newDescribeRemediationExecutionStatus
  Text
pConfigRuleName_ =
    DescribeRemediationExecutionStatus' :: Maybe Text
-> Maybe Natural
-> Maybe (NonEmpty ResourceKey)
-> Text
-> DescribeRemediationExecutionStatus
DescribeRemediationExecutionStatus'
      { $sel:nextToken:DescribeRemediationExecutionStatus' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:limit:DescribeRemediationExecutionStatus' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceKeys:DescribeRemediationExecutionStatus' :: Maybe (NonEmpty ResourceKey)
resourceKeys = Maybe (NonEmpty ResourceKey)
forall a. Maybe a
Prelude.Nothing,
        $sel:configRuleName:DescribeRemediationExecutionStatus' :: Text
configRuleName = Text
pConfigRuleName_
      }

-- | The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
describeRemediationExecutionStatus_nextToken :: Lens.Lens' DescribeRemediationExecutionStatus (Prelude.Maybe Prelude.Text)
describeRemediationExecutionStatus_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeRemediationExecutionStatus
-> f DescribeRemediationExecutionStatus
describeRemediationExecutionStatus_nextToken = (DescribeRemediationExecutionStatus -> Maybe Text)
-> (DescribeRemediationExecutionStatus
    -> Maybe Text -> DescribeRemediationExecutionStatus)
-> Lens
     DescribeRemediationExecutionStatus
     DescribeRemediationExecutionStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRemediationExecutionStatus' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRemediationExecutionStatus
s@DescribeRemediationExecutionStatus' {} Maybe Text
a -> DescribeRemediationExecutionStatus
s {$sel:nextToken:DescribeRemediationExecutionStatus' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRemediationExecutionStatus)

-- | The maximum number of RemediationExecutionStatuses returned on each
-- page. The default is maximum. If you specify 0, Config uses the default.
describeRemediationExecutionStatus_limit :: Lens.Lens' DescribeRemediationExecutionStatus (Prelude.Maybe Prelude.Natural)
describeRemediationExecutionStatus_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeRemediationExecutionStatus
-> f DescribeRemediationExecutionStatus
describeRemediationExecutionStatus_limit = (DescribeRemediationExecutionStatus -> Maybe Natural)
-> (DescribeRemediationExecutionStatus
    -> Maybe Natural -> DescribeRemediationExecutionStatus)
-> Lens
     DescribeRemediationExecutionStatus
     DescribeRemediationExecutionStatus
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRemediationExecutionStatus' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeRemediationExecutionStatus
s@DescribeRemediationExecutionStatus' {} Maybe Natural
a -> DescribeRemediationExecutionStatus
s {$sel:limit:DescribeRemediationExecutionStatus' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeRemediationExecutionStatus)

-- | A list of resource keys to be processed with the current request. Each
-- element in the list consists of the resource type and resource ID.
describeRemediationExecutionStatus_resourceKeys :: Lens.Lens' DescribeRemediationExecutionStatus (Prelude.Maybe (Prelude.NonEmpty ResourceKey))
describeRemediationExecutionStatus_resourceKeys :: (Maybe (NonEmpty ResourceKey) -> f (Maybe (NonEmpty ResourceKey)))
-> DescribeRemediationExecutionStatus
-> f DescribeRemediationExecutionStatus
describeRemediationExecutionStatus_resourceKeys = (DescribeRemediationExecutionStatus
 -> Maybe (NonEmpty ResourceKey))
-> (DescribeRemediationExecutionStatus
    -> Maybe (NonEmpty ResourceKey)
    -> DescribeRemediationExecutionStatus)
-> Lens
     DescribeRemediationExecutionStatus
     DescribeRemediationExecutionStatus
     (Maybe (NonEmpty ResourceKey))
     (Maybe (NonEmpty ResourceKey))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRemediationExecutionStatus' {Maybe (NonEmpty ResourceKey)
resourceKeys :: Maybe (NonEmpty ResourceKey)
$sel:resourceKeys:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Maybe (NonEmpty ResourceKey)
resourceKeys} -> Maybe (NonEmpty ResourceKey)
resourceKeys) (\s :: DescribeRemediationExecutionStatus
s@DescribeRemediationExecutionStatus' {} Maybe (NonEmpty ResourceKey)
a -> DescribeRemediationExecutionStatus
s {$sel:resourceKeys:DescribeRemediationExecutionStatus' :: Maybe (NonEmpty ResourceKey)
resourceKeys = Maybe (NonEmpty ResourceKey)
a} :: DescribeRemediationExecutionStatus) ((Maybe (NonEmpty ResourceKey) -> f (Maybe (NonEmpty ResourceKey)))
 -> DescribeRemediationExecutionStatus
 -> f DescribeRemediationExecutionStatus)
-> ((Maybe (NonEmpty ResourceKey)
     -> f (Maybe (NonEmpty ResourceKey)))
    -> Maybe (NonEmpty ResourceKey)
    -> f (Maybe (NonEmpty ResourceKey)))
-> (Maybe (NonEmpty ResourceKey)
    -> f (Maybe (NonEmpty ResourceKey)))
-> DescribeRemediationExecutionStatus
-> f DescribeRemediationExecutionStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ResourceKey)
  (NonEmpty ResourceKey)
  (NonEmpty ResourceKey)
  (NonEmpty ResourceKey)
-> Iso
     (Maybe (NonEmpty ResourceKey))
     (Maybe (NonEmpty ResourceKey))
     (Maybe (NonEmpty ResourceKey))
     (Maybe (NonEmpty ResourceKey))
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 ResourceKey)
  (NonEmpty ResourceKey)
  (NonEmpty ResourceKey)
  (NonEmpty ResourceKey)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of Config rule names.
describeRemediationExecutionStatus_configRuleName :: Lens.Lens' DescribeRemediationExecutionStatus Prelude.Text
describeRemediationExecutionStatus_configRuleName :: (Text -> f Text)
-> DescribeRemediationExecutionStatus
-> f DescribeRemediationExecutionStatus
describeRemediationExecutionStatus_configRuleName = (DescribeRemediationExecutionStatus -> Text)
-> (DescribeRemediationExecutionStatus
    -> Text -> DescribeRemediationExecutionStatus)
-> Lens
     DescribeRemediationExecutionStatus
     DescribeRemediationExecutionStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRemediationExecutionStatus' {Text
configRuleName :: Text
$sel:configRuleName:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Text
configRuleName} -> Text
configRuleName) (\s :: DescribeRemediationExecutionStatus
s@DescribeRemediationExecutionStatus' {} Text
a -> DescribeRemediationExecutionStatus
s {$sel:configRuleName:DescribeRemediationExecutionStatus' :: Text
configRuleName = Text
a} :: DescribeRemediationExecutionStatus)

instance
  Core.AWSPager
    DescribeRemediationExecutionStatus
  where
  page :: DescribeRemediationExecutionStatus
-> AWSResponse DescribeRemediationExecutionStatus
-> Maybe DescribeRemediationExecutionStatus
page DescribeRemediationExecutionStatus
rq AWSResponse DescribeRemediationExecutionStatus
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeRemediationExecutionStatus
DescribeRemediationExecutionStatusResponse
rs
            DescribeRemediationExecutionStatusResponse
-> Getting
     (First Text) DescribeRemediationExecutionStatusResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeRemediationExecutionStatusResponse
-> Const (First Text) DescribeRemediationExecutionStatusResponse
Lens' DescribeRemediationExecutionStatusResponse (Maybe Text)
describeRemediationExecutionStatusResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeRemediationExecutionStatusResponse
 -> Const (First Text) DescribeRemediationExecutionStatusResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeRemediationExecutionStatusResponse 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 DescribeRemediationExecutionStatus
forall a. Maybe a
Prelude.Nothing
    | Maybe [RemediationExecutionStatus] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeRemediationExecutionStatus
DescribeRemediationExecutionStatusResponse
rs
            DescribeRemediationExecutionStatusResponse
-> Getting
     (First [RemediationExecutionStatus])
     DescribeRemediationExecutionStatusResponse
     [RemediationExecutionStatus]
-> Maybe [RemediationExecutionStatus]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RemediationExecutionStatus]
 -> Const
      (First [RemediationExecutionStatus])
      (Maybe [RemediationExecutionStatus]))
-> DescribeRemediationExecutionStatusResponse
-> Const
     (First [RemediationExecutionStatus])
     DescribeRemediationExecutionStatusResponse
Lens'
  DescribeRemediationExecutionStatusResponse
  (Maybe [RemediationExecutionStatus])
describeRemediationExecutionStatusResponse_remediationExecutionStatuses
              ((Maybe [RemediationExecutionStatus]
  -> Const
       (First [RemediationExecutionStatus])
       (Maybe [RemediationExecutionStatus]))
 -> DescribeRemediationExecutionStatusResponse
 -> Const
      (First [RemediationExecutionStatus])
      DescribeRemediationExecutionStatusResponse)
-> (([RemediationExecutionStatus]
     -> Const
          (First [RemediationExecutionStatus]) [RemediationExecutionStatus])
    -> Maybe [RemediationExecutionStatus]
    -> Const
         (First [RemediationExecutionStatus])
         (Maybe [RemediationExecutionStatus]))
-> Getting
     (First [RemediationExecutionStatus])
     DescribeRemediationExecutionStatusResponse
     [RemediationExecutionStatus]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RemediationExecutionStatus]
 -> Const
      (First [RemediationExecutionStatus]) [RemediationExecutionStatus])
-> Maybe [RemediationExecutionStatus]
-> Const
     (First [RemediationExecutionStatus])
     (Maybe [RemediationExecutionStatus])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeRemediationExecutionStatus
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeRemediationExecutionStatus
-> Maybe DescribeRemediationExecutionStatus
forall a. a -> Maybe a
Prelude.Just (DescribeRemediationExecutionStatus
 -> Maybe DescribeRemediationExecutionStatus)
-> DescribeRemediationExecutionStatus
-> Maybe DescribeRemediationExecutionStatus
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeRemediationExecutionStatus
rq
          DescribeRemediationExecutionStatus
-> (DescribeRemediationExecutionStatus
    -> DescribeRemediationExecutionStatus)
-> DescribeRemediationExecutionStatus
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeRemediationExecutionStatus
-> Identity DescribeRemediationExecutionStatus
Lens
  DescribeRemediationExecutionStatus
  DescribeRemediationExecutionStatus
  (Maybe Text)
  (Maybe Text)
describeRemediationExecutionStatus_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeRemediationExecutionStatus
 -> Identity DescribeRemediationExecutionStatus)
-> Maybe Text
-> DescribeRemediationExecutionStatus
-> DescribeRemediationExecutionStatus
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeRemediationExecutionStatus
DescribeRemediationExecutionStatusResponse
rs
          DescribeRemediationExecutionStatusResponse
-> Getting
     (First Text) DescribeRemediationExecutionStatusResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeRemediationExecutionStatusResponse
-> Const (First Text) DescribeRemediationExecutionStatusResponse
Lens' DescribeRemediationExecutionStatusResponse (Maybe Text)
describeRemediationExecutionStatusResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeRemediationExecutionStatusResponse
 -> Const (First Text) DescribeRemediationExecutionStatusResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeRemediationExecutionStatusResponse 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
    DescribeRemediationExecutionStatus
  where
  type
    AWSResponse DescribeRemediationExecutionStatus =
      DescribeRemediationExecutionStatusResponse
  request :: DescribeRemediationExecutionStatus
-> Request DescribeRemediationExecutionStatus
request = Service
-> DescribeRemediationExecutionStatus
-> Request DescribeRemediationExecutionStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeRemediationExecutionStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeRemediationExecutionStatus)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeRemediationExecutionStatus))
-> Logger
-> Service
-> Proxy DescribeRemediationExecutionStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeRemediationExecutionStatus)))
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 [RemediationExecutionStatus]
-> Maybe Text -> Int -> DescribeRemediationExecutionStatusResponse
DescribeRemediationExecutionStatusResponse'
            (Maybe [RemediationExecutionStatus]
 -> Maybe Text -> Int -> DescribeRemediationExecutionStatusResponse)
-> Either String (Maybe [RemediationExecutionStatus])
-> Either
     String
     (Maybe Text -> Int -> DescribeRemediationExecutionStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [RemediationExecutionStatus]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RemediationExecutionStatuses"
                            Either String (Maybe (Maybe [RemediationExecutionStatus]))
-> Maybe [RemediationExecutionStatus]
-> Either String (Maybe [RemediationExecutionStatus])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RemediationExecutionStatus]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe Text -> Int -> DescribeRemediationExecutionStatusResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> DescribeRemediationExecutionStatusResponse)
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
"NextToken")
              Either String (Int -> DescribeRemediationExecutionStatusResponse)
-> Either String Int
-> Either String DescribeRemediationExecutionStatusResponse
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
    DescribeRemediationExecutionStatus

instance
  Prelude.NFData
    DescribeRemediationExecutionStatus

instance
  Core.ToHeaders
    DescribeRemediationExecutionStatus
  where
  toHeaders :: DescribeRemediationExecutionStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeRemediationExecutionStatus -> 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
"StarlingDoveService.DescribeRemediationExecutionStatus" ::
                          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
    DescribeRemediationExecutionStatus
  where
  toJSON :: DescribeRemediationExecutionStatus -> Value
toJSON DescribeRemediationExecutionStatus' {Maybe Natural
Maybe (NonEmpty ResourceKey)
Maybe Text
Text
configRuleName :: Text
resourceKeys :: Maybe (NonEmpty ResourceKey)
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:configRuleName:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Text
$sel:resourceKeys:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Maybe (NonEmpty ResourceKey)
$sel:limit:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Maybe Natural
$sel:nextToken:DescribeRemediationExecutionStatus' :: DescribeRemediationExecutionStatus -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            (Text
"ResourceKeys" Text -> NonEmpty ResourceKey -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty ResourceKey -> Pair)
-> Maybe (NonEmpty ResourceKey) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourceKey)
resourceKeys,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ConfigRuleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
configRuleName)
          ]
      )

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

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

-- | /See:/ 'newDescribeRemediationExecutionStatusResponse' smart constructor.
data DescribeRemediationExecutionStatusResponse = DescribeRemediationExecutionStatusResponse'
  { -- | Returns a list of remediation execution statuses objects.
    DescribeRemediationExecutionStatusResponse
-> Maybe [RemediationExecutionStatus]
remediationExecutionStatuses :: Prelude.Maybe [RemediationExecutionStatus],
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    DescribeRemediationExecutionStatusResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeRemediationExecutionStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeRemediationExecutionStatusResponse
-> DescribeRemediationExecutionStatusResponse -> Bool
(DescribeRemediationExecutionStatusResponse
 -> DescribeRemediationExecutionStatusResponse -> Bool)
-> (DescribeRemediationExecutionStatusResponse
    -> DescribeRemediationExecutionStatusResponse -> Bool)
-> Eq DescribeRemediationExecutionStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRemediationExecutionStatusResponse
-> DescribeRemediationExecutionStatusResponse -> Bool
$c/= :: DescribeRemediationExecutionStatusResponse
-> DescribeRemediationExecutionStatusResponse -> Bool
== :: DescribeRemediationExecutionStatusResponse
-> DescribeRemediationExecutionStatusResponse -> Bool
$c== :: DescribeRemediationExecutionStatusResponse
-> DescribeRemediationExecutionStatusResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRemediationExecutionStatusResponse]
ReadPrec DescribeRemediationExecutionStatusResponse
Int -> ReadS DescribeRemediationExecutionStatusResponse
ReadS [DescribeRemediationExecutionStatusResponse]
(Int -> ReadS DescribeRemediationExecutionStatusResponse)
-> ReadS [DescribeRemediationExecutionStatusResponse]
-> ReadPrec DescribeRemediationExecutionStatusResponse
-> ReadPrec [DescribeRemediationExecutionStatusResponse]
-> Read DescribeRemediationExecutionStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRemediationExecutionStatusResponse]
$creadListPrec :: ReadPrec [DescribeRemediationExecutionStatusResponse]
readPrec :: ReadPrec DescribeRemediationExecutionStatusResponse
$creadPrec :: ReadPrec DescribeRemediationExecutionStatusResponse
readList :: ReadS [DescribeRemediationExecutionStatusResponse]
$creadList :: ReadS [DescribeRemediationExecutionStatusResponse]
readsPrec :: Int -> ReadS DescribeRemediationExecutionStatusResponse
$creadsPrec :: Int -> ReadS DescribeRemediationExecutionStatusResponse
Prelude.Read, Int -> DescribeRemediationExecutionStatusResponse -> ShowS
[DescribeRemediationExecutionStatusResponse] -> ShowS
DescribeRemediationExecutionStatusResponse -> String
(Int -> DescribeRemediationExecutionStatusResponse -> ShowS)
-> (DescribeRemediationExecutionStatusResponse -> String)
-> ([DescribeRemediationExecutionStatusResponse] -> ShowS)
-> Show DescribeRemediationExecutionStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRemediationExecutionStatusResponse] -> ShowS
$cshowList :: [DescribeRemediationExecutionStatusResponse] -> ShowS
show :: DescribeRemediationExecutionStatusResponse -> String
$cshow :: DescribeRemediationExecutionStatusResponse -> String
showsPrec :: Int -> DescribeRemediationExecutionStatusResponse -> ShowS
$cshowsPrec :: Int -> DescribeRemediationExecutionStatusResponse -> ShowS
Prelude.Show, (forall x.
 DescribeRemediationExecutionStatusResponse
 -> Rep DescribeRemediationExecutionStatusResponse x)
-> (forall x.
    Rep DescribeRemediationExecutionStatusResponse x
    -> DescribeRemediationExecutionStatusResponse)
-> Generic DescribeRemediationExecutionStatusResponse
forall x.
Rep DescribeRemediationExecutionStatusResponse x
-> DescribeRemediationExecutionStatusResponse
forall x.
DescribeRemediationExecutionStatusResponse
-> Rep DescribeRemediationExecutionStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRemediationExecutionStatusResponse x
-> DescribeRemediationExecutionStatusResponse
$cfrom :: forall x.
DescribeRemediationExecutionStatusResponse
-> Rep DescribeRemediationExecutionStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRemediationExecutionStatusResponse' 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:
--
-- 'remediationExecutionStatuses', 'describeRemediationExecutionStatusResponse_remediationExecutionStatuses' - Returns a list of remediation execution statuses objects.
--
-- 'nextToken', 'describeRemediationExecutionStatusResponse_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'httpStatus', 'describeRemediationExecutionStatusResponse_httpStatus' - The response's http status code.
newDescribeRemediationExecutionStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeRemediationExecutionStatusResponse
newDescribeRemediationExecutionStatusResponse :: Int -> DescribeRemediationExecutionStatusResponse
newDescribeRemediationExecutionStatusResponse
  Int
pHttpStatus_ =
    DescribeRemediationExecutionStatusResponse' :: Maybe [RemediationExecutionStatus]
-> Maybe Text -> Int -> DescribeRemediationExecutionStatusResponse
DescribeRemediationExecutionStatusResponse'
      { $sel:remediationExecutionStatuses:DescribeRemediationExecutionStatusResponse' :: Maybe [RemediationExecutionStatus]
remediationExecutionStatuses =
          Maybe [RemediationExecutionStatus]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeRemediationExecutionStatusResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeRemediationExecutionStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Returns a list of remediation execution statuses objects.
describeRemediationExecutionStatusResponse_remediationExecutionStatuses :: Lens.Lens' DescribeRemediationExecutionStatusResponse (Prelude.Maybe [RemediationExecutionStatus])
describeRemediationExecutionStatusResponse_remediationExecutionStatuses :: (Maybe [RemediationExecutionStatus]
 -> f (Maybe [RemediationExecutionStatus]))
-> DescribeRemediationExecutionStatusResponse
-> f DescribeRemediationExecutionStatusResponse
describeRemediationExecutionStatusResponse_remediationExecutionStatuses = (DescribeRemediationExecutionStatusResponse
 -> Maybe [RemediationExecutionStatus])
-> (DescribeRemediationExecutionStatusResponse
    -> Maybe [RemediationExecutionStatus]
    -> DescribeRemediationExecutionStatusResponse)
-> Lens'
     DescribeRemediationExecutionStatusResponse
     (Maybe [RemediationExecutionStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRemediationExecutionStatusResponse' {Maybe [RemediationExecutionStatus]
remediationExecutionStatuses :: Maybe [RemediationExecutionStatus]
$sel:remediationExecutionStatuses:DescribeRemediationExecutionStatusResponse' :: DescribeRemediationExecutionStatusResponse
-> Maybe [RemediationExecutionStatus]
remediationExecutionStatuses} -> Maybe [RemediationExecutionStatus]
remediationExecutionStatuses) (\s :: DescribeRemediationExecutionStatusResponse
s@DescribeRemediationExecutionStatusResponse' {} Maybe [RemediationExecutionStatus]
a -> DescribeRemediationExecutionStatusResponse
s {$sel:remediationExecutionStatuses:DescribeRemediationExecutionStatusResponse' :: Maybe [RemediationExecutionStatus]
remediationExecutionStatuses = Maybe [RemediationExecutionStatus]
a} :: DescribeRemediationExecutionStatusResponse) ((Maybe [RemediationExecutionStatus]
  -> f (Maybe [RemediationExecutionStatus]))
 -> DescribeRemediationExecutionStatusResponse
 -> f DescribeRemediationExecutionStatusResponse)
-> ((Maybe [RemediationExecutionStatus]
     -> f (Maybe [RemediationExecutionStatus]))
    -> Maybe [RemediationExecutionStatus]
    -> f (Maybe [RemediationExecutionStatus]))
-> (Maybe [RemediationExecutionStatus]
    -> f (Maybe [RemediationExecutionStatus]))
-> DescribeRemediationExecutionStatusResponse
-> f DescribeRemediationExecutionStatusResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RemediationExecutionStatus]
  [RemediationExecutionStatus]
  [RemediationExecutionStatus]
  [RemediationExecutionStatus]
-> Iso
     (Maybe [RemediationExecutionStatus])
     (Maybe [RemediationExecutionStatus])
     (Maybe [RemediationExecutionStatus])
     (Maybe [RemediationExecutionStatus])
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
  [RemediationExecutionStatus]
  [RemediationExecutionStatus]
  [RemediationExecutionStatus]
  [RemediationExecutionStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
describeRemediationExecutionStatusResponse_nextToken :: Lens.Lens' DescribeRemediationExecutionStatusResponse (Prelude.Maybe Prelude.Text)
describeRemediationExecutionStatusResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeRemediationExecutionStatusResponse
-> f DescribeRemediationExecutionStatusResponse
describeRemediationExecutionStatusResponse_nextToken = (DescribeRemediationExecutionStatusResponse -> Maybe Text)
-> (DescribeRemediationExecutionStatusResponse
    -> Maybe Text -> DescribeRemediationExecutionStatusResponse)
-> Lens' DescribeRemediationExecutionStatusResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRemediationExecutionStatusResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRemediationExecutionStatusResponse' :: DescribeRemediationExecutionStatusResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRemediationExecutionStatusResponse
s@DescribeRemediationExecutionStatusResponse' {} Maybe Text
a -> DescribeRemediationExecutionStatusResponse
s {$sel:nextToken:DescribeRemediationExecutionStatusResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRemediationExecutionStatusResponse)

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

instance
  Prelude.NFData
    DescribeRemediationExecutionStatusResponse