{-# 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.DescribeAggregateComplianceByConfigRules
-- 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 a list of compliant and noncompliant rules with the number of
-- resources for compliant and noncompliant rules. Does not display rules
-- that do not have compliance results.
--
-- The results can return an empty result page, but if you have a
-- @nextToken@, the results are displayed on the next page.
--
-- This operation returns paginated results.
module Amazonka.Config.DescribeAggregateComplianceByConfigRules
  ( -- * Creating a Request
    DescribeAggregateComplianceByConfigRules (..),
    newDescribeAggregateComplianceByConfigRules,

    -- * Request Lenses
    describeAggregateComplianceByConfigRules_filters,
    describeAggregateComplianceByConfigRules_nextToken,
    describeAggregateComplianceByConfigRules_limit,
    describeAggregateComplianceByConfigRules_configurationAggregatorName,

    -- * Destructuring the Response
    DescribeAggregateComplianceByConfigRulesResponse (..),
    newDescribeAggregateComplianceByConfigRulesResponse,

    -- * Response Lenses
    describeAggregateComplianceByConfigRulesResponse_nextToken,
    describeAggregateComplianceByConfigRulesResponse_aggregateComplianceByConfigRules,
    describeAggregateComplianceByConfigRulesResponse_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:/ 'newDescribeAggregateComplianceByConfigRules' smart constructor.
data DescribeAggregateComplianceByConfigRules = DescribeAggregateComplianceByConfigRules'
  { -- | Filters the results by ConfigRuleComplianceFilters object.
    DescribeAggregateComplianceByConfigRules
-> Maybe ConfigRuleComplianceFilters
filters :: Prelude.Maybe ConfigRuleComplianceFilters,
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    DescribeAggregateComplianceByConfigRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of evaluation results returned on each page. The
    -- default is maximum. If you specify 0, Config uses the default.
    DescribeAggregateComplianceByConfigRules -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The name of the configuration aggregator.
    DescribeAggregateComplianceByConfigRules -> Text
configurationAggregatorName :: Prelude.Text
  }
  deriving (DescribeAggregateComplianceByConfigRules
-> DescribeAggregateComplianceByConfigRules -> Bool
(DescribeAggregateComplianceByConfigRules
 -> DescribeAggregateComplianceByConfigRules -> Bool)
-> (DescribeAggregateComplianceByConfigRules
    -> DescribeAggregateComplianceByConfigRules -> Bool)
-> Eq DescribeAggregateComplianceByConfigRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAggregateComplianceByConfigRules
-> DescribeAggregateComplianceByConfigRules -> Bool
$c/= :: DescribeAggregateComplianceByConfigRules
-> DescribeAggregateComplianceByConfigRules -> Bool
== :: DescribeAggregateComplianceByConfigRules
-> DescribeAggregateComplianceByConfigRules -> Bool
$c== :: DescribeAggregateComplianceByConfigRules
-> DescribeAggregateComplianceByConfigRules -> Bool
Prelude.Eq, ReadPrec [DescribeAggregateComplianceByConfigRules]
ReadPrec DescribeAggregateComplianceByConfigRules
Int -> ReadS DescribeAggregateComplianceByConfigRules
ReadS [DescribeAggregateComplianceByConfigRules]
(Int -> ReadS DescribeAggregateComplianceByConfigRules)
-> ReadS [DescribeAggregateComplianceByConfigRules]
-> ReadPrec DescribeAggregateComplianceByConfigRules
-> ReadPrec [DescribeAggregateComplianceByConfigRules]
-> Read DescribeAggregateComplianceByConfigRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAggregateComplianceByConfigRules]
$creadListPrec :: ReadPrec [DescribeAggregateComplianceByConfigRules]
readPrec :: ReadPrec DescribeAggregateComplianceByConfigRules
$creadPrec :: ReadPrec DescribeAggregateComplianceByConfigRules
readList :: ReadS [DescribeAggregateComplianceByConfigRules]
$creadList :: ReadS [DescribeAggregateComplianceByConfigRules]
readsPrec :: Int -> ReadS DescribeAggregateComplianceByConfigRules
$creadsPrec :: Int -> ReadS DescribeAggregateComplianceByConfigRules
Prelude.Read, Int -> DescribeAggregateComplianceByConfigRules -> ShowS
[DescribeAggregateComplianceByConfigRules] -> ShowS
DescribeAggregateComplianceByConfigRules -> String
(Int -> DescribeAggregateComplianceByConfigRules -> ShowS)
-> (DescribeAggregateComplianceByConfigRules -> String)
-> ([DescribeAggregateComplianceByConfigRules] -> ShowS)
-> Show DescribeAggregateComplianceByConfigRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAggregateComplianceByConfigRules] -> ShowS
$cshowList :: [DescribeAggregateComplianceByConfigRules] -> ShowS
show :: DescribeAggregateComplianceByConfigRules -> String
$cshow :: DescribeAggregateComplianceByConfigRules -> String
showsPrec :: Int -> DescribeAggregateComplianceByConfigRules -> ShowS
$cshowsPrec :: Int -> DescribeAggregateComplianceByConfigRules -> ShowS
Prelude.Show, (forall x.
 DescribeAggregateComplianceByConfigRules
 -> Rep DescribeAggregateComplianceByConfigRules x)
-> (forall x.
    Rep DescribeAggregateComplianceByConfigRules x
    -> DescribeAggregateComplianceByConfigRules)
-> Generic DescribeAggregateComplianceByConfigRules
forall x.
Rep DescribeAggregateComplianceByConfigRules x
-> DescribeAggregateComplianceByConfigRules
forall x.
DescribeAggregateComplianceByConfigRules
-> Rep DescribeAggregateComplianceByConfigRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAggregateComplianceByConfigRules x
-> DescribeAggregateComplianceByConfigRules
$cfrom :: forall x.
DescribeAggregateComplianceByConfigRules
-> Rep DescribeAggregateComplianceByConfigRules x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAggregateComplianceByConfigRules' 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:
--
-- 'filters', 'describeAggregateComplianceByConfigRules_filters' - Filters the results by ConfigRuleComplianceFilters object.
--
-- 'nextToken', 'describeAggregateComplianceByConfigRules_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'describeAggregateComplianceByConfigRules_limit' - The maximum number of evaluation results returned on each page. The
-- default is maximum. If you specify 0, Config uses the default.
--
-- 'configurationAggregatorName', 'describeAggregateComplianceByConfigRules_configurationAggregatorName' - The name of the configuration aggregator.
newDescribeAggregateComplianceByConfigRules ::
  -- | 'configurationAggregatorName'
  Prelude.Text ->
  DescribeAggregateComplianceByConfigRules
newDescribeAggregateComplianceByConfigRules :: Text -> DescribeAggregateComplianceByConfigRules
newDescribeAggregateComplianceByConfigRules
  Text
pConfigurationAggregatorName_ =
    DescribeAggregateComplianceByConfigRules' :: Maybe ConfigRuleComplianceFilters
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeAggregateComplianceByConfigRules
DescribeAggregateComplianceByConfigRules'
      { $sel:filters:DescribeAggregateComplianceByConfigRules' :: Maybe ConfigRuleComplianceFilters
filters =
          Maybe ConfigRuleComplianceFilters
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeAggregateComplianceByConfigRules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:limit:DescribeAggregateComplianceByConfigRules' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:configurationAggregatorName:DescribeAggregateComplianceByConfigRules' :: Text
configurationAggregatorName =
          Text
pConfigurationAggregatorName_
      }

-- | Filters the results by ConfigRuleComplianceFilters object.
describeAggregateComplianceByConfigRules_filters :: Lens.Lens' DescribeAggregateComplianceByConfigRules (Prelude.Maybe ConfigRuleComplianceFilters)
describeAggregateComplianceByConfigRules_filters :: (Maybe ConfigRuleComplianceFilters
 -> f (Maybe ConfigRuleComplianceFilters))
-> DescribeAggregateComplianceByConfigRules
-> f DescribeAggregateComplianceByConfigRules
describeAggregateComplianceByConfigRules_filters = (DescribeAggregateComplianceByConfigRules
 -> Maybe ConfigRuleComplianceFilters)
-> (DescribeAggregateComplianceByConfigRules
    -> Maybe ConfigRuleComplianceFilters
    -> DescribeAggregateComplianceByConfigRules)
-> Lens
     DescribeAggregateComplianceByConfigRules
     DescribeAggregateComplianceByConfigRules
     (Maybe ConfigRuleComplianceFilters)
     (Maybe ConfigRuleComplianceFilters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAggregateComplianceByConfigRules' {Maybe ConfigRuleComplianceFilters
filters :: Maybe ConfigRuleComplianceFilters
$sel:filters:DescribeAggregateComplianceByConfigRules' :: DescribeAggregateComplianceByConfigRules
-> Maybe ConfigRuleComplianceFilters
filters} -> Maybe ConfigRuleComplianceFilters
filters) (\s :: DescribeAggregateComplianceByConfigRules
s@DescribeAggregateComplianceByConfigRules' {} Maybe ConfigRuleComplianceFilters
a -> DescribeAggregateComplianceByConfigRules
s {$sel:filters:DescribeAggregateComplianceByConfigRules' :: Maybe ConfigRuleComplianceFilters
filters = Maybe ConfigRuleComplianceFilters
a} :: DescribeAggregateComplianceByConfigRules)

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

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

-- | The name of the configuration aggregator.
describeAggregateComplianceByConfigRules_configurationAggregatorName :: Lens.Lens' DescribeAggregateComplianceByConfigRules Prelude.Text
describeAggregateComplianceByConfigRules_configurationAggregatorName :: (Text -> f Text)
-> DescribeAggregateComplianceByConfigRules
-> f DescribeAggregateComplianceByConfigRules
describeAggregateComplianceByConfigRules_configurationAggregatorName = (DescribeAggregateComplianceByConfigRules -> Text)
-> (DescribeAggregateComplianceByConfigRules
    -> Text -> DescribeAggregateComplianceByConfigRules)
-> Lens
     DescribeAggregateComplianceByConfigRules
     DescribeAggregateComplianceByConfigRules
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAggregateComplianceByConfigRules' {Text
configurationAggregatorName :: Text
$sel:configurationAggregatorName:DescribeAggregateComplianceByConfigRules' :: DescribeAggregateComplianceByConfigRules -> Text
configurationAggregatorName} -> Text
configurationAggregatorName) (\s :: DescribeAggregateComplianceByConfigRules
s@DescribeAggregateComplianceByConfigRules' {} Text
a -> DescribeAggregateComplianceByConfigRules
s {$sel:configurationAggregatorName:DescribeAggregateComplianceByConfigRules' :: Text
configurationAggregatorName = Text
a} :: DescribeAggregateComplianceByConfigRules)

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

instance
  Prelude.NFData
    DescribeAggregateComplianceByConfigRules

instance
  Core.ToHeaders
    DescribeAggregateComplianceByConfigRules
  where
  toHeaders :: DescribeAggregateComplianceByConfigRules -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeAggregateComplianceByConfigRules -> 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.DescribeAggregateComplianceByConfigRules" ::
                          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
    DescribeAggregateComplianceByConfigRules
  where
  toJSON :: DescribeAggregateComplianceByConfigRules -> Value
toJSON DescribeAggregateComplianceByConfigRules' {Maybe Natural
Maybe Text
Maybe ConfigRuleComplianceFilters
Text
configurationAggregatorName :: Text
limit :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe ConfigRuleComplianceFilters
$sel:configurationAggregatorName:DescribeAggregateComplianceByConfigRules' :: DescribeAggregateComplianceByConfigRules -> Text
$sel:limit:DescribeAggregateComplianceByConfigRules' :: DescribeAggregateComplianceByConfigRules -> Maybe Natural
$sel:nextToken:DescribeAggregateComplianceByConfigRules' :: DescribeAggregateComplianceByConfigRules -> Maybe Text
$sel:filters:DescribeAggregateComplianceByConfigRules' :: DescribeAggregateComplianceByConfigRules
-> Maybe ConfigRuleComplianceFilters
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> ConfigRuleComplianceFilters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ConfigRuleComplianceFilters -> Pair)
-> Maybe ConfigRuleComplianceFilters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigRuleComplianceFilters
filters,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ConfigurationAggregatorName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
configurationAggregatorName
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeAggregateComplianceByConfigRulesResponse' 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', 'describeAggregateComplianceByConfigRulesResponse_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'aggregateComplianceByConfigRules', 'describeAggregateComplianceByConfigRulesResponse_aggregateComplianceByConfigRules' - Returns a list of AggregateComplianceByConfigRule object.
--
-- 'httpStatus', 'describeAggregateComplianceByConfigRulesResponse_httpStatus' - The response's http status code.
newDescribeAggregateComplianceByConfigRulesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAggregateComplianceByConfigRulesResponse
newDescribeAggregateComplianceByConfigRulesResponse :: Int -> DescribeAggregateComplianceByConfigRulesResponse
newDescribeAggregateComplianceByConfigRulesResponse
  Int
pHttpStatus_ =
    DescribeAggregateComplianceByConfigRulesResponse' :: Maybe Text
-> Maybe [AggregateComplianceByConfigRule]
-> Int
-> DescribeAggregateComplianceByConfigRulesResponse
DescribeAggregateComplianceByConfigRulesResponse'
      { $sel:nextToken:DescribeAggregateComplianceByConfigRulesResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:aggregateComplianceByConfigRules:DescribeAggregateComplianceByConfigRulesResponse' :: Maybe [AggregateComplianceByConfigRule]
aggregateComplianceByConfigRules =
          Maybe [AggregateComplianceByConfigRule]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeAggregateComplianceByConfigRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

-- | Returns a list of AggregateComplianceByConfigRule object.
describeAggregateComplianceByConfigRulesResponse_aggregateComplianceByConfigRules :: Lens.Lens' DescribeAggregateComplianceByConfigRulesResponse (Prelude.Maybe [AggregateComplianceByConfigRule])
describeAggregateComplianceByConfigRulesResponse_aggregateComplianceByConfigRules :: (Maybe [AggregateComplianceByConfigRule]
 -> f (Maybe [AggregateComplianceByConfigRule]))
-> DescribeAggregateComplianceByConfigRulesResponse
-> f DescribeAggregateComplianceByConfigRulesResponse
describeAggregateComplianceByConfigRulesResponse_aggregateComplianceByConfigRules = (DescribeAggregateComplianceByConfigRulesResponse
 -> Maybe [AggregateComplianceByConfigRule])
-> (DescribeAggregateComplianceByConfigRulesResponse
    -> Maybe [AggregateComplianceByConfigRule]
    -> DescribeAggregateComplianceByConfigRulesResponse)
-> Lens'
     DescribeAggregateComplianceByConfigRulesResponse
     (Maybe [AggregateComplianceByConfigRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAggregateComplianceByConfigRulesResponse' {Maybe [AggregateComplianceByConfigRule]
aggregateComplianceByConfigRules :: Maybe [AggregateComplianceByConfigRule]
$sel:aggregateComplianceByConfigRules:DescribeAggregateComplianceByConfigRulesResponse' :: DescribeAggregateComplianceByConfigRulesResponse
-> Maybe [AggregateComplianceByConfigRule]
aggregateComplianceByConfigRules} -> Maybe [AggregateComplianceByConfigRule]
aggregateComplianceByConfigRules) (\s :: DescribeAggregateComplianceByConfigRulesResponse
s@DescribeAggregateComplianceByConfigRulesResponse' {} Maybe [AggregateComplianceByConfigRule]
a -> DescribeAggregateComplianceByConfigRulesResponse
s {$sel:aggregateComplianceByConfigRules:DescribeAggregateComplianceByConfigRulesResponse' :: Maybe [AggregateComplianceByConfigRule]
aggregateComplianceByConfigRules = Maybe [AggregateComplianceByConfigRule]
a} :: DescribeAggregateComplianceByConfigRulesResponse) ((Maybe [AggregateComplianceByConfigRule]
  -> f (Maybe [AggregateComplianceByConfigRule]))
 -> DescribeAggregateComplianceByConfigRulesResponse
 -> f DescribeAggregateComplianceByConfigRulesResponse)
-> ((Maybe [AggregateComplianceByConfigRule]
     -> f (Maybe [AggregateComplianceByConfigRule]))
    -> Maybe [AggregateComplianceByConfigRule]
    -> f (Maybe [AggregateComplianceByConfigRule]))
-> (Maybe [AggregateComplianceByConfigRule]
    -> f (Maybe [AggregateComplianceByConfigRule]))
-> DescribeAggregateComplianceByConfigRulesResponse
-> f DescribeAggregateComplianceByConfigRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AggregateComplianceByConfigRule]
  [AggregateComplianceByConfigRule]
  [AggregateComplianceByConfigRule]
  [AggregateComplianceByConfigRule]
-> Iso
     (Maybe [AggregateComplianceByConfigRule])
     (Maybe [AggregateComplianceByConfigRule])
     (Maybe [AggregateComplianceByConfigRule])
     (Maybe [AggregateComplianceByConfigRule])
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
  [AggregateComplianceByConfigRule]
  [AggregateComplianceByConfigRule]
  [AggregateComplianceByConfigRule]
  [AggregateComplianceByConfigRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAggregateComplianceByConfigRulesResponse