{-# 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.GetAggregateConfigRuleComplianceSummary
-- 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 the number of compliant and noncompliant rules for one or more
-- accounts and regions in an aggregator.
--
-- The results can return an empty result page, but if you have a
-- nextToken, the results are displayed on the next page.
module Amazonka.Config.GetAggregateConfigRuleComplianceSummary
  ( -- * Creating a Request
    GetAggregateConfigRuleComplianceSummary (..),
    newGetAggregateConfigRuleComplianceSummary,

    -- * Request Lenses
    getAggregateConfigRuleComplianceSummary_filters,
    getAggregateConfigRuleComplianceSummary_nextToken,
    getAggregateConfigRuleComplianceSummary_limit,
    getAggregateConfigRuleComplianceSummary_groupByKey,
    getAggregateConfigRuleComplianceSummary_configurationAggregatorName,

    -- * Destructuring the Response
    GetAggregateConfigRuleComplianceSummaryResponse (..),
    newGetAggregateConfigRuleComplianceSummaryResponse,

    -- * Response Lenses
    getAggregateConfigRuleComplianceSummaryResponse_aggregateComplianceCounts,
    getAggregateConfigRuleComplianceSummaryResponse_nextToken,
    getAggregateConfigRuleComplianceSummaryResponse_groupByKey,
    getAggregateConfigRuleComplianceSummaryResponse_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:/ 'newGetAggregateConfigRuleComplianceSummary' smart constructor.
data GetAggregateConfigRuleComplianceSummary = GetAggregateConfigRuleComplianceSummary'
  { -- | Filters the results based on the ConfigRuleComplianceSummaryFilters
    -- object.
    GetAggregateConfigRuleComplianceSummary
-> Maybe ConfigRuleComplianceSummaryFilters
filters :: Prelude.Maybe ConfigRuleComplianceSummaryFilters,
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    GetAggregateConfigRuleComplianceSummary -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of evaluation results returned on each page. The
    -- default is 1000. You cannot specify a number greater than 1000. If you
    -- specify 0, Config uses the default.
    GetAggregateConfigRuleComplianceSummary -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | Groups the result based on ACCOUNT_ID or AWS_REGION.
    GetAggregateConfigRuleComplianceSummary
-> Maybe ConfigRuleComplianceSummaryGroupKey
groupByKey :: Prelude.Maybe ConfigRuleComplianceSummaryGroupKey,
    -- | The name of the configuration aggregator.
    GetAggregateConfigRuleComplianceSummary -> Text
configurationAggregatorName :: Prelude.Text
  }
  deriving (GetAggregateConfigRuleComplianceSummary
-> GetAggregateConfigRuleComplianceSummary -> Bool
(GetAggregateConfigRuleComplianceSummary
 -> GetAggregateConfigRuleComplianceSummary -> Bool)
-> (GetAggregateConfigRuleComplianceSummary
    -> GetAggregateConfigRuleComplianceSummary -> Bool)
-> Eq GetAggregateConfigRuleComplianceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAggregateConfigRuleComplianceSummary
-> GetAggregateConfigRuleComplianceSummary -> Bool
$c/= :: GetAggregateConfigRuleComplianceSummary
-> GetAggregateConfigRuleComplianceSummary -> Bool
== :: GetAggregateConfigRuleComplianceSummary
-> GetAggregateConfigRuleComplianceSummary -> Bool
$c== :: GetAggregateConfigRuleComplianceSummary
-> GetAggregateConfigRuleComplianceSummary -> Bool
Prelude.Eq, ReadPrec [GetAggregateConfigRuleComplianceSummary]
ReadPrec GetAggregateConfigRuleComplianceSummary
Int -> ReadS GetAggregateConfigRuleComplianceSummary
ReadS [GetAggregateConfigRuleComplianceSummary]
(Int -> ReadS GetAggregateConfigRuleComplianceSummary)
-> ReadS [GetAggregateConfigRuleComplianceSummary]
-> ReadPrec GetAggregateConfigRuleComplianceSummary
-> ReadPrec [GetAggregateConfigRuleComplianceSummary]
-> Read GetAggregateConfigRuleComplianceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAggregateConfigRuleComplianceSummary]
$creadListPrec :: ReadPrec [GetAggregateConfigRuleComplianceSummary]
readPrec :: ReadPrec GetAggregateConfigRuleComplianceSummary
$creadPrec :: ReadPrec GetAggregateConfigRuleComplianceSummary
readList :: ReadS [GetAggregateConfigRuleComplianceSummary]
$creadList :: ReadS [GetAggregateConfigRuleComplianceSummary]
readsPrec :: Int -> ReadS GetAggregateConfigRuleComplianceSummary
$creadsPrec :: Int -> ReadS GetAggregateConfigRuleComplianceSummary
Prelude.Read, Int -> GetAggregateConfigRuleComplianceSummary -> ShowS
[GetAggregateConfigRuleComplianceSummary] -> ShowS
GetAggregateConfigRuleComplianceSummary -> String
(Int -> GetAggregateConfigRuleComplianceSummary -> ShowS)
-> (GetAggregateConfigRuleComplianceSummary -> String)
-> ([GetAggregateConfigRuleComplianceSummary] -> ShowS)
-> Show GetAggregateConfigRuleComplianceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAggregateConfigRuleComplianceSummary] -> ShowS
$cshowList :: [GetAggregateConfigRuleComplianceSummary] -> ShowS
show :: GetAggregateConfigRuleComplianceSummary -> String
$cshow :: GetAggregateConfigRuleComplianceSummary -> String
showsPrec :: Int -> GetAggregateConfigRuleComplianceSummary -> ShowS
$cshowsPrec :: Int -> GetAggregateConfigRuleComplianceSummary -> ShowS
Prelude.Show, (forall x.
 GetAggregateConfigRuleComplianceSummary
 -> Rep GetAggregateConfigRuleComplianceSummary x)
-> (forall x.
    Rep GetAggregateConfigRuleComplianceSummary x
    -> GetAggregateConfigRuleComplianceSummary)
-> Generic GetAggregateConfigRuleComplianceSummary
forall x.
Rep GetAggregateConfigRuleComplianceSummary x
-> GetAggregateConfigRuleComplianceSummary
forall x.
GetAggregateConfigRuleComplianceSummary
-> Rep GetAggregateConfigRuleComplianceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAggregateConfigRuleComplianceSummary x
-> GetAggregateConfigRuleComplianceSummary
$cfrom :: forall x.
GetAggregateConfigRuleComplianceSummary
-> Rep GetAggregateConfigRuleComplianceSummary x
Prelude.Generic)

-- |
-- Create a value of 'GetAggregateConfigRuleComplianceSummary' 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', 'getAggregateConfigRuleComplianceSummary_filters' - Filters the results based on the ConfigRuleComplianceSummaryFilters
-- object.
--
-- 'nextToken', 'getAggregateConfigRuleComplianceSummary_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'getAggregateConfigRuleComplianceSummary_limit' - The maximum number of evaluation results returned on each page. The
-- default is 1000. You cannot specify a number greater than 1000. If you
-- specify 0, Config uses the default.
--
-- 'groupByKey', 'getAggregateConfigRuleComplianceSummary_groupByKey' - Groups the result based on ACCOUNT_ID or AWS_REGION.
--
-- 'configurationAggregatorName', 'getAggregateConfigRuleComplianceSummary_configurationAggregatorName' - The name of the configuration aggregator.
newGetAggregateConfigRuleComplianceSummary ::
  -- | 'configurationAggregatorName'
  Prelude.Text ->
  GetAggregateConfigRuleComplianceSummary
newGetAggregateConfigRuleComplianceSummary :: Text -> GetAggregateConfigRuleComplianceSummary
newGetAggregateConfigRuleComplianceSummary
  Text
pConfigurationAggregatorName_ =
    GetAggregateConfigRuleComplianceSummary' :: Maybe ConfigRuleComplianceSummaryFilters
-> Maybe Text
-> Maybe Natural
-> Maybe ConfigRuleComplianceSummaryGroupKey
-> Text
-> GetAggregateConfigRuleComplianceSummary
GetAggregateConfigRuleComplianceSummary'
      { $sel:filters:GetAggregateConfigRuleComplianceSummary' :: Maybe ConfigRuleComplianceSummaryFilters
filters =
          Maybe ConfigRuleComplianceSummaryFilters
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetAggregateConfigRuleComplianceSummary' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:limit:GetAggregateConfigRuleComplianceSummary' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:groupByKey:GetAggregateConfigRuleComplianceSummary' :: Maybe ConfigRuleComplianceSummaryGroupKey
groupByKey = Maybe ConfigRuleComplianceSummaryGroupKey
forall a. Maybe a
Prelude.Nothing,
        $sel:configurationAggregatorName:GetAggregateConfigRuleComplianceSummary' :: Text
configurationAggregatorName =
          Text
pConfigurationAggregatorName_
      }

-- | Filters the results based on the ConfigRuleComplianceSummaryFilters
-- object.
getAggregateConfigRuleComplianceSummary_filters :: Lens.Lens' GetAggregateConfigRuleComplianceSummary (Prelude.Maybe ConfigRuleComplianceSummaryFilters)
getAggregateConfigRuleComplianceSummary_filters :: (Maybe ConfigRuleComplianceSummaryFilters
 -> f (Maybe ConfigRuleComplianceSummaryFilters))
-> GetAggregateConfigRuleComplianceSummary
-> f GetAggregateConfigRuleComplianceSummary
getAggregateConfigRuleComplianceSummary_filters = (GetAggregateConfigRuleComplianceSummary
 -> Maybe ConfigRuleComplianceSummaryFilters)
-> (GetAggregateConfigRuleComplianceSummary
    -> Maybe ConfigRuleComplianceSummaryFilters
    -> GetAggregateConfigRuleComplianceSummary)
-> Lens
     GetAggregateConfigRuleComplianceSummary
     GetAggregateConfigRuleComplianceSummary
     (Maybe ConfigRuleComplianceSummaryFilters)
     (Maybe ConfigRuleComplianceSummaryFilters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateConfigRuleComplianceSummary' {Maybe ConfigRuleComplianceSummaryFilters
filters :: Maybe ConfigRuleComplianceSummaryFilters
$sel:filters:GetAggregateConfigRuleComplianceSummary' :: GetAggregateConfigRuleComplianceSummary
-> Maybe ConfigRuleComplianceSummaryFilters
filters} -> Maybe ConfigRuleComplianceSummaryFilters
filters) (\s :: GetAggregateConfigRuleComplianceSummary
s@GetAggregateConfigRuleComplianceSummary' {} Maybe ConfigRuleComplianceSummaryFilters
a -> GetAggregateConfigRuleComplianceSummary
s {$sel:filters:GetAggregateConfigRuleComplianceSummary' :: Maybe ConfigRuleComplianceSummaryFilters
filters = Maybe ConfigRuleComplianceSummaryFilters
a} :: GetAggregateConfigRuleComplianceSummary)

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

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

-- | Groups the result based on ACCOUNT_ID or AWS_REGION.
getAggregateConfigRuleComplianceSummary_groupByKey :: Lens.Lens' GetAggregateConfigRuleComplianceSummary (Prelude.Maybe ConfigRuleComplianceSummaryGroupKey)
getAggregateConfigRuleComplianceSummary_groupByKey :: (Maybe ConfigRuleComplianceSummaryGroupKey
 -> f (Maybe ConfigRuleComplianceSummaryGroupKey))
-> GetAggregateConfigRuleComplianceSummary
-> f GetAggregateConfigRuleComplianceSummary
getAggregateConfigRuleComplianceSummary_groupByKey = (GetAggregateConfigRuleComplianceSummary
 -> Maybe ConfigRuleComplianceSummaryGroupKey)
-> (GetAggregateConfigRuleComplianceSummary
    -> Maybe ConfigRuleComplianceSummaryGroupKey
    -> GetAggregateConfigRuleComplianceSummary)
-> Lens
     GetAggregateConfigRuleComplianceSummary
     GetAggregateConfigRuleComplianceSummary
     (Maybe ConfigRuleComplianceSummaryGroupKey)
     (Maybe ConfigRuleComplianceSummaryGroupKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateConfigRuleComplianceSummary' {Maybe ConfigRuleComplianceSummaryGroupKey
groupByKey :: Maybe ConfigRuleComplianceSummaryGroupKey
$sel:groupByKey:GetAggregateConfigRuleComplianceSummary' :: GetAggregateConfigRuleComplianceSummary
-> Maybe ConfigRuleComplianceSummaryGroupKey
groupByKey} -> Maybe ConfigRuleComplianceSummaryGroupKey
groupByKey) (\s :: GetAggregateConfigRuleComplianceSummary
s@GetAggregateConfigRuleComplianceSummary' {} Maybe ConfigRuleComplianceSummaryGroupKey
a -> GetAggregateConfigRuleComplianceSummary
s {$sel:groupByKey:GetAggregateConfigRuleComplianceSummary' :: Maybe ConfigRuleComplianceSummaryGroupKey
groupByKey = Maybe ConfigRuleComplianceSummaryGroupKey
a} :: GetAggregateConfigRuleComplianceSummary)

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

instance
  Core.AWSRequest
    GetAggregateConfigRuleComplianceSummary
  where
  type
    AWSResponse
      GetAggregateConfigRuleComplianceSummary =
      GetAggregateConfigRuleComplianceSummaryResponse
  request :: GetAggregateConfigRuleComplianceSummary
-> Request GetAggregateConfigRuleComplianceSummary
request = Service
-> GetAggregateConfigRuleComplianceSummary
-> Request GetAggregateConfigRuleComplianceSummary
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAggregateConfigRuleComplianceSummary
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetAggregateConfigRuleComplianceSummary)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse GetAggregateConfigRuleComplianceSummary))
-> Logger
-> Service
-> Proxy GetAggregateConfigRuleComplianceSummary
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetAggregateConfigRuleComplianceSummary)))
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 [AggregateComplianceCount]
-> Maybe Text
-> Maybe Text
-> Int
-> GetAggregateConfigRuleComplianceSummaryResponse
GetAggregateConfigRuleComplianceSummaryResponse'
            (Maybe [AggregateComplianceCount]
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Either String (Maybe [AggregateComplianceCount])
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Int
      -> GetAggregateConfigRuleComplianceSummaryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [AggregateComplianceCount]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AggregateComplianceCounts"
                            Either String (Maybe (Maybe [AggregateComplianceCount]))
-> Maybe [AggregateComplianceCount]
-> Either String (Maybe [AggregateComplianceCount])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AggregateComplianceCount]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe Text
   -> Maybe Text
   -> Int
   -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Int -> GetAggregateConfigRuleComplianceSummaryResponse)
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
  (Maybe Text
   -> Int -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> GetAggregateConfigRuleComplianceSummaryResponse)
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
"GroupByKey")
              Either
  String (Int -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Either String Int
-> Either String GetAggregateConfigRuleComplianceSummaryResponse
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
    GetAggregateConfigRuleComplianceSummary

instance
  Prelude.NFData
    GetAggregateConfigRuleComplianceSummary

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

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

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

-- |
-- Create a value of 'GetAggregateConfigRuleComplianceSummaryResponse' 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:
--
-- 'aggregateComplianceCounts', 'getAggregateConfigRuleComplianceSummaryResponse_aggregateComplianceCounts' - Returns a list of AggregateComplianceCounts object.
--
-- 'nextToken', 'getAggregateConfigRuleComplianceSummaryResponse_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'groupByKey', 'getAggregateConfigRuleComplianceSummaryResponse_groupByKey' - Groups the result based on ACCOUNT_ID or AWS_REGION.
--
-- 'httpStatus', 'getAggregateConfigRuleComplianceSummaryResponse_httpStatus' - The response's http status code.
newGetAggregateConfigRuleComplianceSummaryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAggregateConfigRuleComplianceSummaryResponse
newGetAggregateConfigRuleComplianceSummaryResponse :: Int -> GetAggregateConfigRuleComplianceSummaryResponse
newGetAggregateConfigRuleComplianceSummaryResponse
  Int
pHttpStatus_ =
    GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe [AggregateComplianceCount]
-> Maybe Text
-> Maybe Text
-> Int
-> GetAggregateConfigRuleComplianceSummaryResponse
GetAggregateConfigRuleComplianceSummaryResponse'
      { $sel:aggregateComplianceCounts:GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe [AggregateComplianceCount]
aggregateComplianceCounts =
          Maybe [AggregateComplianceCount]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:groupByKey:GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe Text
groupByKey =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetAggregateConfigRuleComplianceSummaryResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Returns a list of AggregateComplianceCounts object.
getAggregateConfigRuleComplianceSummaryResponse_aggregateComplianceCounts :: Lens.Lens' GetAggregateConfigRuleComplianceSummaryResponse (Prelude.Maybe [AggregateComplianceCount])
getAggregateConfigRuleComplianceSummaryResponse_aggregateComplianceCounts :: (Maybe [AggregateComplianceCount]
 -> f (Maybe [AggregateComplianceCount]))
-> GetAggregateConfigRuleComplianceSummaryResponse
-> f GetAggregateConfigRuleComplianceSummaryResponse
getAggregateConfigRuleComplianceSummaryResponse_aggregateComplianceCounts = (GetAggregateConfigRuleComplianceSummaryResponse
 -> Maybe [AggregateComplianceCount])
-> (GetAggregateConfigRuleComplianceSummaryResponse
    -> Maybe [AggregateComplianceCount]
    -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Lens
     GetAggregateConfigRuleComplianceSummaryResponse
     GetAggregateConfigRuleComplianceSummaryResponse
     (Maybe [AggregateComplianceCount])
     (Maybe [AggregateComplianceCount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateConfigRuleComplianceSummaryResponse' {Maybe [AggregateComplianceCount]
aggregateComplianceCounts :: Maybe [AggregateComplianceCount]
$sel:aggregateComplianceCounts:GetAggregateConfigRuleComplianceSummaryResponse' :: GetAggregateConfigRuleComplianceSummaryResponse
-> Maybe [AggregateComplianceCount]
aggregateComplianceCounts} -> Maybe [AggregateComplianceCount]
aggregateComplianceCounts) (\s :: GetAggregateConfigRuleComplianceSummaryResponse
s@GetAggregateConfigRuleComplianceSummaryResponse' {} Maybe [AggregateComplianceCount]
a -> GetAggregateConfigRuleComplianceSummaryResponse
s {$sel:aggregateComplianceCounts:GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe [AggregateComplianceCount]
aggregateComplianceCounts = Maybe [AggregateComplianceCount]
a} :: GetAggregateConfigRuleComplianceSummaryResponse) ((Maybe [AggregateComplianceCount]
  -> f (Maybe [AggregateComplianceCount]))
 -> GetAggregateConfigRuleComplianceSummaryResponse
 -> f GetAggregateConfigRuleComplianceSummaryResponse)
-> ((Maybe [AggregateComplianceCount]
     -> f (Maybe [AggregateComplianceCount]))
    -> Maybe [AggregateComplianceCount]
    -> f (Maybe [AggregateComplianceCount]))
-> (Maybe [AggregateComplianceCount]
    -> f (Maybe [AggregateComplianceCount]))
-> GetAggregateConfigRuleComplianceSummaryResponse
-> f GetAggregateConfigRuleComplianceSummaryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AggregateComplianceCount]
  [AggregateComplianceCount]
  [AggregateComplianceCount]
  [AggregateComplianceCount]
-> Iso
     (Maybe [AggregateComplianceCount])
     (Maybe [AggregateComplianceCount])
     (Maybe [AggregateComplianceCount])
     (Maybe [AggregateComplianceCount])
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
  [AggregateComplianceCount]
  [AggregateComplianceCount]
  [AggregateComplianceCount]
  [AggregateComplianceCount]
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.
getAggregateConfigRuleComplianceSummaryResponse_nextToken :: Lens.Lens' GetAggregateConfigRuleComplianceSummaryResponse (Prelude.Maybe Prelude.Text)
getAggregateConfigRuleComplianceSummaryResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetAggregateConfigRuleComplianceSummaryResponse
-> f GetAggregateConfigRuleComplianceSummaryResponse
getAggregateConfigRuleComplianceSummaryResponse_nextToken = (GetAggregateConfigRuleComplianceSummaryResponse -> Maybe Text)
-> (GetAggregateConfigRuleComplianceSummaryResponse
    -> Maybe Text -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Lens
     GetAggregateConfigRuleComplianceSummaryResponse
     GetAggregateConfigRuleComplianceSummaryResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateConfigRuleComplianceSummaryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetAggregateConfigRuleComplianceSummaryResponse' :: GetAggregateConfigRuleComplianceSummaryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetAggregateConfigRuleComplianceSummaryResponse
s@GetAggregateConfigRuleComplianceSummaryResponse' {} Maybe Text
a -> GetAggregateConfigRuleComplianceSummaryResponse
s {$sel:nextToken:GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetAggregateConfigRuleComplianceSummaryResponse)

-- | Groups the result based on ACCOUNT_ID or AWS_REGION.
getAggregateConfigRuleComplianceSummaryResponse_groupByKey :: Lens.Lens' GetAggregateConfigRuleComplianceSummaryResponse (Prelude.Maybe Prelude.Text)
getAggregateConfigRuleComplianceSummaryResponse_groupByKey :: (Maybe Text -> f (Maybe Text))
-> GetAggregateConfigRuleComplianceSummaryResponse
-> f GetAggregateConfigRuleComplianceSummaryResponse
getAggregateConfigRuleComplianceSummaryResponse_groupByKey = (GetAggregateConfigRuleComplianceSummaryResponse -> Maybe Text)
-> (GetAggregateConfigRuleComplianceSummaryResponse
    -> Maybe Text -> GetAggregateConfigRuleComplianceSummaryResponse)
-> Lens
     GetAggregateConfigRuleComplianceSummaryResponse
     GetAggregateConfigRuleComplianceSummaryResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateConfigRuleComplianceSummaryResponse' {Maybe Text
groupByKey :: Maybe Text
$sel:groupByKey:GetAggregateConfigRuleComplianceSummaryResponse' :: GetAggregateConfigRuleComplianceSummaryResponse -> Maybe Text
groupByKey} -> Maybe Text
groupByKey) (\s :: GetAggregateConfigRuleComplianceSummaryResponse
s@GetAggregateConfigRuleComplianceSummaryResponse' {} Maybe Text
a -> GetAggregateConfigRuleComplianceSummaryResponse
s {$sel:groupByKey:GetAggregateConfigRuleComplianceSummaryResponse' :: Maybe Text
groupByKey = Maybe Text
a} :: GetAggregateConfigRuleComplianceSummaryResponse)

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

instance
  Prelude.NFData
    GetAggregateConfigRuleComplianceSummaryResponse