{-# 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.DescribeConfigRuleEvaluationStatus
-- 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 status information for each of your Config managed rules. The
-- status includes information such as the last time Config invoked the
-- rule, the last time Config failed to invoke the rule, and the related
-- error for the last failure.
--
-- This operation returns paginated results.
module Amazonka.Config.DescribeConfigRuleEvaluationStatus
  ( -- * Creating a Request
    DescribeConfigRuleEvaluationStatus (..),
    newDescribeConfigRuleEvaluationStatus,

    -- * Request Lenses
    describeConfigRuleEvaluationStatus_configRuleNames,
    describeConfigRuleEvaluationStatus_nextToken,
    describeConfigRuleEvaluationStatus_limit,

    -- * Destructuring the Response
    DescribeConfigRuleEvaluationStatusResponse (..),
    newDescribeConfigRuleEvaluationStatusResponse,

    -- * Response Lenses
    describeConfigRuleEvaluationStatusResponse_configRulesEvaluationStatus,
    describeConfigRuleEvaluationStatusResponse_nextToken,
    describeConfigRuleEvaluationStatusResponse_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:/ 'newDescribeConfigRuleEvaluationStatus' smart constructor.
data DescribeConfigRuleEvaluationStatus = DescribeConfigRuleEvaluationStatus'
  { -- | The name of the Config managed rules for which you want status
    -- information. If you do not specify any names, Config returns status
    -- information for all Config managed rules that you use.
    DescribeConfigRuleEvaluationStatus -> Maybe [Text]
configRuleNames :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    DescribeConfigRuleEvaluationStatus -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of rule evaluation results that you want returned.
    --
    -- This parameter is required if the rule limit for your account is more
    -- than the default of 150 rules.
    --
    -- For information about requesting a rule limit increase, see
    -- <http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_config Config Limits>
    -- in the /Amazon Web Services General Reference Guide/.
    DescribeConfigRuleEvaluationStatus -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeConfigRuleEvaluationStatus
-> DescribeConfigRuleEvaluationStatus -> Bool
(DescribeConfigRuleEvaluationStatus
 -> DescribeConfigRuleEvaluationStatus -> Bool)
-> (DescribeConfigRuleEvaluationStatus
    -> DescribeConfigRuleEvaluationStatus -> Bool)
-> Eq DescribeConfigRuleEvaluationStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeConfigRuleEvaluationStatus
-> DescribeConfigRuleEvaluationStatus -> Bool
$c/= :: DescribeConfigRuleEvaluationStatus
-> DescribeConfigRuleEvaluationStatus -> Bool
== :: DescribeConfigRuleEvaluationStatus
-> DescribeConfigRuleEvaluationStatus -> Bool
$c== :: DescribeConfigRuleEvaluationStatus
-> DescribeConfigRuleEvaluationStatus -> Bool
Prelude.Eq, ReadPrec [DescribeConfigRuleEvaluationStatus]
ReadPrec DescribeConfigRuleEvaluationStatus
Int -> ReadS DescribeConfigRuleEvaluationStatus
ReadS [DescribeConfigRuleEvaluationStatus]
(Int -> ReadS DescribeConfigRuleEvaluationStatus)
-> ReadS [DescribeConfigRuleEvaluationStatus]
-> ReadPrec DescribeConfigRuleEvaluationStatus
-> ReadPrec [DescribeConfigRuleEvaluationStatus]
-> Read DescribeConfigRuleEvaluationStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeConfigRuleEvaluationStatus]
$creadListPrec :: ReadPrec [DescribeConfigRuleEvaluationStatus]
readPrec :: ReadPrec DescribeConfigRuleEvaluationStatus
$creadPrec :: ReadPrec DescribeConfigRuleEvaluationStatus
readList :: ReadS [DescribeConfigRuleEvaluationStatus]
$creadList :: ReadS [DescribeConfigRuleEvaluationStatus]
readsPrec :: Int -> ReadS DescribeConfigRuleEvaluationStatus
$creadsPrec :: Int -> ReadS DescribeConfigRuleEvaluationStatus
Prelude.Read, Int -> DescribeConfigRuleEvaluationStatus -> ShowS
[DescribeConfigRuleEvaluationStatus] -> ShowS
DescribeConfigRuleEvaluationStatus -> String
(Int -> DescribeConfigRuleEvaluationStatus -> ShowS)
-> (DescribeConfigRuleEvaluationStatus -> String)
-> ([DescribeConfigRuleEvaluationStatus] -> ShowS)
-> Show DescribeConfigRuleEvaluationStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeConfigRuleEvaluationStatus] -> ShowS
$cshowList :: [DescribeConfigRuleEvaluationStatus] -> ShowS
show :: DescribeConfigRuleEvaluationStatus -> String
$cshow :: DescribeConfigRuleEvaluationStatus -> String
showsPrec :: Int -> DescribeConfigRuleEvaluationStatus -> ShowS
$cshowsPrec :: Int -> DescribeConfigRuleEvaluationStatus -> ShowS
Prelude.Show, (forall x.
 DescribeConfigRuleEvaluationStatus
 -> Rep DescribeConfigRuleEvaluationStatus x)
-> (forall x.
    Rep DescribeConfigRuleEvaluationStatus x
    -> DescribeConfigRuleEvaluationStatus)
-> Generic DescribeConfigRuleEvaluationStatus
forall x.
Rep DescribeConfigRuleEvaluationStatus x
-> DescribeConfigRuleEvaluationStatus
forall x.
DescribeConfigRuleEvaluationStatus
-> Rep DescribeConfigRuleEvaluationStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeConfigRuleEvaluationStatus x
-> DescribeConfigRuleEvaluationStatus
$cfrom :: forall x.
DescribeConfigRuleEvaluationStatus
-> Rep DescribeConfigRuleEvaluationStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeConfigRuleEvaluationStatus' 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:
--
-- 'configRuleNames', 'describeConfigRuleEvaluationStatus_configRuleNames' - The name of the Config managed rules for which you want status
-- information. If you do not specify any names, Config returns status
-- information for all Config managed rules that you use.
--
-- 'nextToken', 'describeConfigRuleEvaluationStatus_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'describeConfigRuleEvaluationStatus_limit' - The number of rule evaluation results that you want returned.
--
-- This parameter is required if the rule limit for your account is more
-- than the default of 150 rules.
--
-- For information about requesting a rule limit increase, see
-- <http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_config Config Limits>
-- in the /Amazon Web Services General Reference Guide/.
newDescribeConfigRuleEvaluationStatus ::
  DescribeConfigRuleEvaluationStatus
newDescribeConfigRuleEvaluationStatus :: DescribeConfigRuleEvaluationStatus
newDescribeConfigRuleEvaluationStatus =
  DescribeConfigRuleEvaluationStatus' :: Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> DescribeConfigRuleEvaluationStatus
DescribeConfigRuleEvaluationStatus'
    { $sel:configRuleNames:DescribeConfigRuleEvaluationStatus' :: Maybe [Text]
configRuleNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeConfigRuleEvaluationStatus' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeConfigRuleEvaluationStatus' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Config managed rules for which you want status
-- information. If you do not specify any names, Config returns status
-- information for all Config managed rules that you use.
describeConfigRuleEvaluationStatus_configRuleNames :: Lens.Lens' DescribeConfigRuleEvaluationStatus (Prelude.Maybe [Prelude.Text])
describeConfigRuleEvaluationStatus_configRuleNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeConfigRuleEvaluationStatus
-> f DescribeConfigRuleEvaluationStatus
describeConfigRuleEvaluationStatus_configRuleNames = (DescribeConfigRuleEvaluationStatus -> Maybe [Text])
-> (DescribeConfigRuleEvaluationStatus
    -> Maybe [Text] -> DescribeConfigRuleEvaluationStatus)
-> Lens
     DescribeConfigRuleEvaluationStatus
     DescribeConfigRuleEvaluationStatus
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConfigRuleEvaluationStatus' {Maybe [Text]
configRuleNames :: Maybe [Text]
$sel:configRuleNames:DescribeConfigRuleEvaluationStatus' :: DescribeConfigRuleEvaluationStatus -> Maybe [Text]
configRuleNames} -> Maybe [Text]
configRuleNames) (\s :: DescribeConfigRuleEvaluationStatus
s@DescribeConfigRuleEvaluationStatus' {} Maybe [Text]
a -> DescribeConfigRuleEvaluationStatus
s {$sel:configRuleNames:DescribeConfigRuleEvaluationStatus' :: Maybe [Text]
configRuleNames = Maybe [Text]
a} :: DescribeConfigRuleEvaluationStatus) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeConfigRuleEvaluationStatus
 -> f DescribeConfigRuleEvaluationStatus)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeConfigRuleEvaluationStatus
-> f DescribeConfigRuleEvaluationStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
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.
describeConfigRuleEvaluationStatus_nextToken :: Lens.Lens' DescribeConfigRuleEvaluationStatus (Prelude.Maybe Prelude.Text)
describeConfigRuleEvaluationStatus_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeConfigRuleEvaluationStatus
-> f DescribeConfigRuleEvaluationStatus
describeConfigRuleEvaluationStatus_nextToken = (DescribeConfigRuleEvaluationStatus -> Maybe Text)
-> (DescribeConfigRuleEvaluationStatus
    -> Maybe Text -> DescribeConfigRuleEvaluationStatus)
-> Lens
     DescribeConfigRuleEvaluationStatus
     DescribeConfigRuleEvaluationStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConfigRuleEvaluationStatus' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeConfigRuleEvaluationStatus' :: DescribeConfigRuleEvaluationStatus -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeConfigRuleEvaluationStatus
s@DescribeConfigRuleEvaluationStatus' {} Maybe Text
a -> DescribeConfigRuleEvaluationStatus
s {$sel:nextToken:DescribeConfigRuleEvaluationStatus' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeConfigRuleEvaluationStatus)

-- | The number of rule evaluation results that you want returned.
--
-- This parameter is required if the rule limit for your account is more
-- than the default of 150 rules.
--
-- For information about requesting a rule limit increase, see
-- <http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_config Config Limits>
-- in the /Amazon Web Services General Reference Guide/.
describeConfigRuleEvaluationStatus_limit :: Lens.Lens' DescribeConfigRuleEvaluationStatus (Prelude.Maybe Prelude.Natural)
describeConfigRuleEvaluationStatus_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeConfigRuleEvaluationStatus
-> f DescribeConfigRuleEvaluationStatus
describeConfigRuleEvaluationStatus_limit = (DescribeConfigRuleEvaluationStatus -> Maybe Natural)
-> (DescribeConfigRuleEvaluationStatus
    -> Maybe Natural -> DescribeConfigRuleEvaluationStatus)
-> Lens
     DescribeConfigRuleEvaluationStatus
     DescribeConfigRuleEvaluationStatus
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConfigRuleEvaluationStatus' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeConfigRuleEvaluationStatus' :: DescribeConfigRuleEvaluationStatus -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeConfigRuleEvaluationStatus
s@DescribeConfigRuleEvaluationStatus' {} Maybe Natural
a -> DescribeConfigRuleEvaluationStatus
s {$sel:limit:DescribeConfigRuleEvaluationStatus' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeConfigRuleEvaluationStatus)

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

instance
  Prelude.NFData
    DescribeConfigRuleEvaluationStatus

instance
  Core.ToHeaders
    DescribeConfigRuleEvaluationStatus
  where
  toHeaders :: DescribeConfigRuleEvaluationStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeConfigRuleEvaluationStatus -> 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.DescribeConfigRuleEvaluationStatus" ::
                          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
    DescribeConfigRuleEvaluationStatus
  where
  toJSON :: DescribeConfigRuleEvaluationStatus -> Value
toJSON DescribeConfigRuleEvaluationStatus' {Maybe Natural
Maybe [Text]
Maybe Text
limit :: Maybe Natural
nextToken :: Maybe Text
configRuleNames :: Maybe [Text]
$sel:limit:DescribeConfigRuleEvaluationStatus' :: DescribeConfigRuleEvaluationStatus -> Maybe Natural
$sel:nextToken:DescribeConfigRuleEvaluationStatus' :: DescribeConfigRuleEvaluationStatus -> Maybe Text
$sel:configRuleNames:DescribeConfigRuleEvaluationStatus' :: DescribeConfigRuleEvaluationStatus -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ConfigRuleNames" 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]
configRuleNames,
            (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
          ]
      )

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

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

-- |
--
-- /See:/ 'newDescribeConfigRuleEvaluationStatusResponse' smart constructor.
data DescribeConfigRuleEvaluationStatusResponse = DescribeConfigRuleEvaluationStatusResponse'
  { -- | Status information about your Config managed rules.
    DescribeConfigRuleEvaluationStatusResponse
-> Maybe [ConfigRuleEvaluationStatus]
configRulesEvaluationStatus :: Prelude.Maybe [ConfigRuleEvaluationStatus],
    -- | The string that you use in a subsequent request to get the next page of
    -- results in a paginated response.
    DescribeConfigRuleEvaluationStatusResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeConfigRuleEvaluationStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeConfigRuleEvaluationStatusResponse
-> DescribeConfigRuleEvaluationStatusResponse -> Bool
(DescribeConfigRuleEvaluationStatusResponse
 -> DescribeConfigRuleEvaluationStatusResponse -> Bool)
-> (DescribeConfigRuleEvaluationStatusResponse
    -> DescribeConfigRuleEvaluationStatusResponse -> Bool)
-> Eq DescribeConfigRuleEvaluationStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeConfigRuleEvaluationStatusResponse
-> DescribeConfigRuleEvaluationStatusResponse -> Bool
$c/= :: DescribeConfigRuleEvaluationStatusResponse
-> DescribeConfigRuleEvaluationStatusResponse -> Bool
== :: DescribeConfigRuleEvaluationStatusResponse
-> DescribeConfigRuleEvaluationStatusResponse -> Bool
$c== :: DescribeConfigRuleEvaluationStatusResponse
-> DescribeConfigRuleEvaluationStatusResponse -> Bool
Prelude.Eq, ReadPrec [DescribeConfigRuleEvaluationStatusResponse]
ReadPrec DescribeConfigRuleEvaluationStatusResponse
Int -> ReadS DescribeConfigRuleEvaluationStatusResponse
ReadS [DescribeConfigRuleEvaluationStatusResponse]
(Int -> ReadS DescribeConfigRuleEvaluationStatusResponse)
-> ReadS [DescribeConfigRuleEvaluationStatusResponse]
-> ReadPrec DescribeConfigRuleEvaluationStatusResponse
-> ReadPrec [DescribeConfigRuleEvaluationStatusResponse]
-> Read DescribeConfigRuleEvaluationStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeConfigRuleEvaluationStatusResponse]
$creadListPrec :: ReadPrec [DescribeConfigRuleEvaluationStatusResponse]
readPrec :: ReadPrec DescribeConfigRuleEvaluationStatusResponse
$creadPrec :: ReadPrec DescribeConfigRuleEvaluationStatusResponse
readList :: ReadS [DescribeConfigRuleEvaluationStatusResponse]
$creadList :: ReadS [DescribeConfigRuleEvaluationStatusResponse]
readsPrec :: Int -> ReadS DescribeConfigRuleEvaluationStatusResponse
$creadsPrec :: Int -> ReadS DescribeConfigRuleEvaluationStatusResponse
Prelude.Read, Int -> DescribeConfigRuleEvaluationStatusResponse -> ShowS
[DescribeConfigRuleEvaluationStatusResponse] -> ShowS
DescribeConfigRuleEvaluationStatusResponse -> String
(Int -> DescribeConfigRuleEvaluationStatusResponse -> ShowS)
-> (DescribeConfigRuleEvaluationStatusResponse -> String)
-> ([DescribeConfigRuleEvaluationStatusResponse] -> ShowS)
-> Show DescribeConfigRuleEvaluationStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeConfigRuleEvaluationStatusResponse] -> ShowS
$cshowList :: [DescribeConfigRuleEvaluationStatusResponse] -> ShowS
show :: DescribeConfigRuleEvaluationStatusResponse -> String
$cshow :: DescribeConfigRuleEvaluationStatusResponse -> String
showsPrec :: Int -> DescribeConfigRuleEvaluationStatusResponse -> ShowS
$cshowsPrec :: Int -> DescribeConfigRuleEvaluationStatusResponse -> ShowS
Prelude.Show, (forall x.
 DescribeConfigRuleEvaluationStatusResponse
 -> Rep DescribeConfigRuleEvaluationStatusResponse x)
-> (forall x.
    Rep DescribeConfigRuleEvaluationStatusResponse x
    -> DescribeConfigRuleEvaluationStatusResponse)
-> Generic DescribeConfigRuleEvaluationStatusResponse
forall x.
Rep DescribeConfigRuleEvaluationStatusResponse x
-> DescribeConfigRuleEvaluationStatusResponse
forall x.
DescribeConfigRuleEvaluationStatusResponse
-> Rep DescribeConfigRuleEvaluationStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeConfigRuleEvaluationStatusResponse x
-> DescribeConfigRuleEvaluationStatusResponse
$cfrom :: forall x.
DescribeConfigRuleEvaluationStatusResponse
-> Rep DescribeConfigRuleEvaluationStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeConfigRuleEvaluationStatusResponse' 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:
--
-- 'configRulesEvaluationStatus', 'describeConfigRuleEvaluationStatusResponse_configRulesEvaluationStatus' - Status information about your Config managed rules.
--
-- 'nextToken', 'describeConfigRuleEvaluationStatusResponse_nextToken' - The string that you use in a subsequent request to get the next page of
-- results in a paginated response.
--
-- 'httpStatus', 'describeConfigRuleEvaluationStatusResponse_httpStatus' - The response's http status code.
newDescribeConfigRuleEvaluationStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeConfigRuleEvaluationStatusResponse
newDescribeConfigRuleEvaluationStatusResponse :: Int -> DescribeConfigRuleEvaluationStatusResponse
newDescribeConfigRuleEvaluationStatusResponse
  Int
pHttpStatus_ =
    DescribeConfigRuleEvaluationStatusResponse' :: Maybe [ConfigRuleEvaluationStatus]
-> Maybe Text -> Int -> DescribeConfigRuleEvaluationStatusResponse
DescribeConfigRuleEvaluationStatusResponse'
      { $sel:configRulesEvaluationStatus:DescribeConfigRuleEvaluationStatusResponse' :: Maybe [ConfigRuleEvaluationStatus]
configRulesEvaluationStatus =
          Maybe [ConfigRuleEvaluationStatus]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeConfigRuleEvaluationStatusResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeConfigRuleEvaluationStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Status information about your Config managed rules.
describeConfigRuleEvaluationStatusResponse_configRulesEvaluationStatus :: Lens.Lens' DescribeConfigRuleEvaluationStatusResponse (Prelude.Maybe [ConfigRuleEvaluationStatus])
describeConfigRuleEvaluationStatusResponse_configRulesEvaluationStatus :: (Maybe [ConfigRuleEvaluationStatus]
 -> f (Maybe [ConfigRuleEvaluationStatus]))
-> DescribeConfigRuleEvaluationStatusResponse
-> f DescribeConfigRuleEvaluationStatusResponse
describeConfigRuleEvaluationStatusResponse_configRulesEvaluationStatus = (DescribeConfigRuleEvaluationStatusResponse
 -> Maybe [ConfigRuleEvaluationStatus])
-> (DescribeConfigRuleEvaluationStatusResponse
    -> Maybe [ConfigRuleEvaluationStatus]
    -> DescribeConfigRuleEvaluationStatusResponse)
-> Lens'
     DescribeConfigRuleEvaluationStatusResponse
     (Maybe [ConfigRuleEvaluationStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConfigRuleEvaluationStatusResponse' {Maybe [ConfigRuleEvaluationStatus]
configRulesEvaluationStatus :: Maybe [ConfigRuleEvaluationStatus]
$sel:configRulesEvaluationStatus:DescribeConfigRuleEvaluationStatusResponse' :: DescribeConfigRuleEvaluationStatusResponse
-> Maybe [ConfigRuleEvaluationStatus]
configRulesEvaluationStatus} -> Maybe [ConfigRuleEvaluationStatus]
configRulesEvaluationStatus) (\s :: DescribeConfigRuleEvaluationStatusResponse
s@DescribeConfigRuleEvaluationStatusResponse' {} Maybe [ConfigRuleEvaluationStatus]
a -> DescribeConfigRuleEvaluationStatusResponse
s {$sel:configRulesEvaluationStatus:DescribeConfigRuleEvaluationStatusResponse' :: Maybe [ConfigRuleEvaluationStatus]
configRulesEvaluationStatus = Maybe [ConfigRuleEvaluationStatus]
a} :: DescribeConfigRuleEvaluationStatusResponse) ((Maybe [ConfigRuleEvaluationStatus]
  -> f (Maybe [ConfigRuleEvaluationStatus]))
 -> DescribeConfigRuleEvaluationStatusResponse
 -> f DescribeConfigRuleEvaluationStatusResponse)
-> ((Maybe [ConfigRuleEvaluationStatus]
     -> f (Maybe [ConfigRuleEvaluationStatus]))
    -> Maybe [ConfigRuleEvaluationStatus]
    -> f (Maybe [ConfigRuleEvaluationStatus]))
-> (Maybe [ConfigRuleEvaluationStatus]
    -> f (Maybe [ConfigRuleEvaluationStatus]))
-> DescribeConfigRuleEvaluationStatusResponse
-> f DescribeConfigRuleEvaluationStatusResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConfigRuleEvaluationStatus]
  [ConfigRuleEvaluationStatus]
  [ConfigRuleEvaluationStatus]
  [ConfigRuleEvaluationStatus]
-> Iso
     (Maybe [ConfigRuleEvaluationStatus])
     (Maybe [ConfigRuleEvaluationStatus])
     (Maybe [ConfigRuleEvaluationStatus])
     (Maybe [ConfigRuleEvaluationStatus])
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
  [ConfigRuleEvaluationStatus]
  [ConfigRuleEvaluationStatus]
  [ConfigRuleEvaluationStatus]
  [ConfigRuleEvaluationStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    DescribeConfigRuleEvaluationStatusResponse