{-# 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.GetAggregateDiscoveredResourceCounts
-- 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 resource counts across accounts and regions that are present
-- in your Config aggregator. You can request the resource counts by
-- providing filters and GroupByKey.
--
-- For example, if the input contains accountID 12345678910 and region
-- us-east-1 in filters, the API returns the count of resources in account
-- ID 12345678910 and region us-east-1. If the input contains ACCOUNT_ID as
-- a GroupByKey, the API returns resource counts for all source accounts
-- that are present in your aggregator.
module Amazonka.Config.GetAggregateDiscoveredResourceCounts
  ( -- * Creating a Request
    GetAggregateDiscoveredResourceCounts (..),
    newGetAggregateDiscoveredResourceCounts,

    -- * Request Lenses
    getAggregateDiscoveredResourceCounts_filters,
    getAggregateDiscoveredResourceCounts_nextToken,
    getAggregateDiscoveredResourceCounts_limit,
    getAggregateDiscoveredResourceCounts_groupByKey,
    getAggregateDiscoveredResourceCounts_configurationAggregatorName,

    -- * Destructuring the Response
    GetAggregateDiscoveredResourceCountsResponse (..),
    newGetAggregateDiscoveredResourceCountsResponse,

    -- * Response Lenses
    getAggregateDiscoveredResourceCountsResponse_groupedResourceCounts,
    getAggregateDiscoveredResourceCountsResponse_nextToken,
    getAggregateDiscoveredResourceCountsResponse_groupByKey,
    getAggregateDiscoveredResourceCountsResponse_httpStatus,
    getAggregateDiscoveredResourceCountsResponse_totalDiscoveredResources,
  )
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:/ 'newGetAggregateDiscoveredResourceCounts' smart constructor.
data GetAggregateDiscoveredResourceCounts = GetAggregateDiscoveredResourceCounts'
  { -- | Filters the results based on the @ResourceCountFilters@ object.
    GetAggregateDiscoveredResourceCounts -> Maybe ResourceCountFilters
filters :: Prelude.Maybe ResourceCountFilters,
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    GetAggregateDiscoveredResourceCounts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of GroupedResourceCount objects returned on each
    -- page. The default is 1000. You cannot specify a number greater than
    -- 1000. If you specify 0, Config uses the default.
    GetAggregateDiscoveredResourceCounts -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The key to group the resource counts.
    GetAggregateDiscoveredResourceCounts -> Maybe ResourceCountGroupKey
groupByKey :: Prelude.Maybe ResourceCountGroupKey,
    -- | The name of the configuration aggregator.
    GetAggregateDiscoveredResourceCounts -> Text
configurationAggregatorName :: Prelude.Text
  }
  deriving (GetAggregateDiscoveredResourceCounts
-> GetAggregateDiscoveredResourceCounts -> Bool
(GetAggregateDiscoveredResourceCounts
 -> GetAggregateDiscoveredResourceCounts -> Bool)
-> (GetAggregateDiscoveredResourceCounts
    -> GetAggregateDiscoveredResourceCounts -> Bool)
-> Eq GetAggregateDiscoveredResourceCounts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAggregateDiscoveredResourceCounts
-> GetAggregateDiscoveredResourceCounts -> Bool
$c/= :: GetAggregateDiscoveredResourceCounts
-> GetAggregateDiscoveredResourceCounts -> Bool
== :: GetAggregateDiscoveredResourceCounts
-> GetAggregateDiscoveredResourceCounts -> Bool
$c== :: GetAggregateDiscoveredResourceCounts
-> GetAggregateDiscoveredResourceCounts -> Bool
Prelude.Eq, ReadPrec [GetAggregateDiscoveredResourceCounts]
ReadPrec GetAggregateDiscoveredResourceCounts
Int -> ReadS GetAggregateDiscoveredResourceCounts
ReadS [GetAggregateDiscoveredResourceCounts]
(Int -> ReadS GetAggregateDiscoveredResourceCounts)
-> ReadS [GetAggregateDiscoveredResourceCounts]
-> ReadPrec GetAggregateDiscoveredResourceCounts
-> ReadPrec [GetAggregateDiscoveredResourceCounts]
-> Read GetAggregateDiscoveredResourceCounts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAggregateDiscoveredResourceCounts]
$creadListPrec :: ReadPrec [GetAggregateDiscoveredResourceCounts]
readPrec :: ReadPrec GetAggregateDiscoveredResourceCounts
$creadPrec :: ReadPrec GetAggregateDiscoveredResourceCounts
readList :: ReadS [GetAggregateDiscoveredResourceCounts]
$creadList :: ReadS [GetAggregateDiscoveredResourceCounts]
readsPrec :: Int -> ReadS GetAggregateDiscoveredResourceCounts
$creadsPrec :: Int -> ReadS GetAggregateDiscoveredResourceCounts
Prelude.Read, Int -> GetAggregateDiscoveredResourceCounts -> ShowS
[GetAggregateDiscoveredResourceCounts] -> ShowS
GetAggregateDiscoveredResourceCounts -> String
(Int -> GetAggregateDiscoveredResourceCounts -> ShowS)
-> (GetAggregateDiscoveredResourceCounts -> String)
-> ([GetAggregateDiscoveredResourceCounts] -> ShowS)
-> Show GetAggregateDiscoveredResourceCounts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAggregateDiscoveredResourceCounts] -> ShowS
$cshowList :: [GetAggregateDiscoveredResourceCounts] -> ShowS
show :: GetAggregateDiscoveredResourceCounts -> String
$cshow :: GetAggregateDiscoveredResourceCounts -> String
showsPrec :: Int -> GetAggregateDiscoveredResourceCounts -> ShowS
$cshowsPrec :: Int -> GetAggregateDiscoveredResourceCounts -> ShowS
Prelude.Show, (forall x.
 GetAggregateDiscoveredResourceCounts
 -> Rep GetAggregateDiscoveredResourceCounts x)
-> (forall x.
    Rep GetAggregateDiscoveredResourceCounts x
    -> GetAggregateDiscoveredResourceCounts)
-> Generic GetAggregateDiscoveredResourceCounts
forall x.
Rep GetAggregateDiscoveredResourceCounts x
-> GetAggregateDiscoveredResourceCounts
forall x.
GetAggregateDiscoveredResourceCounts
-> Rep GetAggregateDiscoveredResourceCounts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAggregateDiscoveredResourceCounts x
-> GetAggregateDiscoveredResourceCounts
$cfrom :: forall x.
GetAggregateDiscoveredResourceCounts
-> Rep GetAggregateDiscoveredResourceCounts x
Prelude.Generic)

-- |
-- Create a value of 'GetAggregateDiscoveredResourceCounts' 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', 'getAggregateDiscoveredResourceCounts_filters' - Filters the results based on the @ResourceCountFilters@ object.
--
-- 'nextToken', 'getAggregateDiscoveredResourceCounts_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'getAggregateDiscoveredResourceCounts_limit' - The maximum number of GroupedResourceCount objects 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', 'getAggregateDiscoveredResourceCounts_groupByKey' - The key to group the resource counts.
--
-- 'configurationAggregatorName', 'getAggregateDiscoveredResourceCounts_configurationAggregatorName' - The name of the configuration aggregator.
newGetAggregateDiscoveredResourceCounts ::
  -- | 'configurationAggregatorName'
  Prelude.Text ->
  GetAggregateDiscoveredResourceCounts
newGetAggregateDiscoveredResourceCounts :: Text -> GetAggregateDiscoveredResourceCounts
newGetAggregateDiscoveredResourceCounts
  Text
pConfigurationAggregatorName_ =
    GetAggregateDiscoveredResourceCounts' :: Maybe ResourceCountFilters
-> Maybe Text
-> Maybe Natural
-> Maybe ResourceCountGroupKey
-> Text
-> GetAggregateDiscoveredResourceCounts
GetAggregateDiscoveredResourceCounts'
      { $sel:filters:GetAggregateDiscoveredResourceCounts' :: Maybe ResourceCountFilters
filters =
          Maybe ResourceCountFilters
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetAggregateDiscoveredResourceCounts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:limit:GetAggregateDiscoveredResourceCounts' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:groupByKey:GetAggregateDiscoveredResourceCounts' :: Maybe ResourceCountGroupKey
groupByKey = Maybe ResourceCountGroupKey
forall a. Maybe a
Prelude.Nothing,
        $sel:configurationAggregatorName:GetAggregateDiscoveredResourceCounts' :: Text
configurationAggregatorName =
          Text
pConfigurationAggregatorName_
      }

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

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

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

-- | The key to group the resource counts.
getAggregateDiscoveredResourceCounts_groupByKey :: Lens.Lens' GetAggregateDiscoveredResourceCounts (Prelude.Maybe ResourceCountGroupKey)
getAggregateDiscoveredResourceCounts_groupByKey :: (Maybe ResourceCountGroupKey -> f (Maybe ResourceCountGroupKey))
-> GetAggregateDiscoveredResourceCounts
-> f GetAggregateDiscoveredResourceCounts
getAggregateDiscoveredResourceCounts_groupByKey = (GetAggregateDiscoveredResourceCounts
 -> Maybe ResourceCountGroupKey)
-> (GetAggregateDiscoveredResourceCounts
    -> Maybe ResourceCountGroupKey
    -> GetAggregateDiscoveredResourceCounts)
-> Lens
     GetAggregateDiscoveredResourceCounts
     GetAggregateDiscoveredResourceCounts
     (Maybe ResourceCountGroupKey)
     (Maybe ResourceCountGroupKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateDiscoveredResourceCounts' {Maybe ResourceCountGroupKey
groupByKey :: Maybe ResourceCountGroupKey
$sel:groupByKey:GetAggregateDiscoveredResourceCounts' :: GetAggregateDiscoveredResourceCounts -> Maybe ResourceCountGroupKey
groupByKey} -> Maybe ResourceCountGroupKey
groupByKey) (\s :: GetAggregateDiscoveredResourceCounts
s@GetAggregateDiscoveredResourceCounts' {} Maybe ResourceCountGroupKey
a -> GetAggregateDiscoveredResourceCounts
s {$sel:groupByKey:GetAggregateDiscoveredResourceCounts' :: Maybe ResourceCountGroupKey
groupByKey = Maybe ResourceCountGroupKey
a} :: GetAggregateDiscoveredResourceCounts)

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

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

instance
  Prelude.Hashable
    GetAggregateDiscoveredResourceCounts

instance
  Prelude.NFData
    GetAggregateDiscoveredResourceCounts

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

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

-- | /See:/ 'newGetAggregateDiscoveredResourceCountsResponse' smart constructor.
data GetAggregateDiscoveredResourceCountsResponse = GetAggregateDiscoveredResourceCountsResponse'
  { -- | Returns a list of GroupedResourceCount objects.
    GetAggregateDiscoveredResourceCountsResponse
-> Maybe [GroupedResourceCount]
groupedResourceCounts :: Prelude.Maybe [GroupedResourceCount],
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    GetAggregateDiscoveredResourceCountsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The key passed into the request object. If @GroupByKey@ is not provided,
    -- the result will be empty.
    GetAggregateDiscoveredResourceCountsResponse -> Maybe Text
groupByKey :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetAggregateDiscoveredResourceCountsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The total number of resources that are present in an aggregator with the
    -- filters that you provide.
    GetAggregateDiscoveredResourceCountsResponse -> Integer
totalDiscoveredResources :: Prelude.Integer
  }
  deriving (GetAggregateDiscoveredResourceCountsResponse
-> GetAggregateDiscoveredResourceCountsResponse -> Bool
(GetAggregateDiscoveredResourceCountsResponse
 -> GetAggregateDiscoveredResourceCountsResponse -> Bool)
-> (GetAggregateDiscoveredResourceCountsResponse
    -> GetAggregateDiscoveredResourceCountsResponse -> Bool)
-> Eq GetAggregateDiscoveredResourceCountsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAggregateDiscoveredResourceCountsResponse
-> GetAggregateDiscoveredResourceCountsResponse -> Bool
$c/= :: GetAggregateDiscoveredResourceCountsResponse
-> GetAggregateDiscoveredResourceCountsResponse -> Bool
== :: GetAggregateDiscoveredResourceCountsResponse
-> GetAggregateDiscoveredResourceCountsResponse -> Bool
$c== :: GetAggregateDiscoveredResourceCountsResponse
-> GetAggregateDiscoveredResourceCountsResponse -> Bool
Prelude.Eq, ReadPrec [GetAggregateDiscoveredResourceCountsResponse]
ReadPrec GetAggregateDiscoveredResourceCountsResponse
Int -> ReadS GetAggregateDiscoveredResourceCountsResponse
ReadS [GetAggregateDiscoveredResourceCountsResponse]
(Int -> ReadS GetAggregateDiscoveredResourceCountsResponse)
-> ReadS [GetAggregateDiscoveredResourceCountsResponse]
-> ReadPrec GetAggregateDiscoveredResourceCountsResponse
-> ReadPrec [GetAggregateDiscoveredResourceCountsResponse]
-> Read GetAggregateDiscoveredResourceCountsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAggregateDiscoveredResourceCountsResponse]
$creadListPrec :: ReadPrec [GetAggregateDiscoveredResourceCountsResponse]
readPrec :: ReadPrec GetAggregateDiscoveredResourceCountsResponse
$creadPrec :: ReadPrec GetAggregateDiscoveredResourceCountsResponse
readList :: ReadS [GetAggregateDiscoveredResourceCountsResponse]
$creadList :: ReadS [GetAggregateDiscoveredResourceCountsResponse]
readsPrec :: Int -> ReadS GetAggregateDiscoveredResourceCountsResponse
$creadsPrec :: Int -> ReadS GetAggregateDiscoveredResourceCountsResponse
Prelude.Read, Int -> GetAggregateDiscoveredResourceCountsResponse -> ShowS
[GetAggregateDiscoveredResourceCountsResponse] -> ShowS
GetAggregateDiscoveredResourceCountsResponse -> String
(Int -> GetAggregateDiscoveredResourceCountsResponse -> ShowS)
-> (GetAggregateDiscoveredResourceCountsResponse -> String)
-> ([GetAggregateDiscoveredResourceCountsResponse] -> ShowS)
-> Show GetAggregateDiscoveredResourceCountsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAggregateDiscoveredResourceCountsResponse] -> ShowS
$cshowList :: [GetAggregateDiscoveredResourceCountsResponse] -> ShowS
show :: GetAggregateDiscoveredResourceCountsResponse -> String
$cshow :: GetAggregateDiscoveredResourceCountsResponse -> String
showsPrec :: Int -> GetAggregateDiscoveredResourceCountsResponse -> ShowS
$cshowsPrec :: Int -> GetAggregateDiscoveredResourceCountsResponse -> ShowS
Prelude.Show, (forall x.
 GetAggregateDiscoveredResourceCountsResponse
 -> Rep GetAggregateDiscoveredResourceCountsResponse x)
-> (forall x.
    Rep GetAggregateDiscoveredResourceCountsResponse x
    -> GetAggregateDiscoveredResourceCountsResponse)
-> Generic GetAggregateDiscoveredResourceCountsResponse
forall x.
Rep GetAggregateDiscoveredResourceCountsResponse x
-> GetAggregateDiscoveredResourceCountsResponse
forall x.
GetAggregateDiscoveredResourceCountsResponse
-> Rep GetAggregateDiscoveredResourceCountsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAggregateDiscoveredResourceCountsResponse x
-> GetAggregateDiscoveredResourceCountsResponse
$cfrom :: forall x.
GetAggregateDiscoveredResourceCountsResponse
-> Rep GetAggregateDiscoveredResourceCountsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAggregateDiscoveredResourceCountsResponse' 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:
--
-- 'groupedResourceCounts', 'getAggregateDiscoveredResourceCountsResponse_groupedResourceCounts' - Returns a list of GroupedResourceCount objects.
--
-- 'nextToken', 'getAggregateDiscoveredResourceCountsResponse_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'groupByKey', 'getAggregateDiscoveredResourceCountsResponse_groupByKey' - The key passed into the request object. If @GroupByKey@ is not provided,
-- the result will be empty.
--
-- 'httpStatus', 'getAggregateDiscoveredResourceCountsResponse_httpStatus' - The response's http status code.
--
-- 'totalDiscoveredResources', 'getAggregateDiscoveredResourceCountsResponse_totalDiscoveredResources' - The total number of resources that are present in an aggregator with the
-- filters that you provide.
newGetAggregateDiscoveredResourceCountsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'totalDiscoveredResources'
  Prelude.Integer ->
  GetAggregateDiscoveredResourceCountsResponse
newGetAggregateDiscoveredResourceCountsResponse :: Int -> Integer -> GetAggregateDiscoveredResourceCountsResponse
newGetAggregateDiscoveredResourceCountsResponse
  Int
pHttpStatus_
  Integer
pTotalDiscoveredResources_ =
    GetAggregateDiscoveredResourceCountsResponse' :: Maybe [GroupedResourceCount]
-> Maybe Text
-> Maybe Text
-> Int
-> Integer
-> GetAggregateDiscoveredResourceCountsResponse
GetAggregateDiscoveredResourceCountsResponse'
      { $sel:groupedResourceCounts:GetAggregateDiscoveredResourceCountsResponse' :: Maybe [GroupedResourceCount]
groupedResourceCounts =
          Maybe [GroupedResourceCount]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetAggregateDiscoveredResourceCountsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:groupByKey:GetAggregateDiscoveredResourceCountsResponse' :: Maybe Text
groupByKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetAggregateDiscoveredResourceCountsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:totalDiscoveredResources:GetAggregateDiscoveredResourceCountsResponse' :: Integer
totalDiscoveredResources =
          Integer
pTotalDiscoveredResources_
      }

-- | Returns a list of GroupedResourceCount objects.
getAggregateDiscoveredResourceCountsResponse_groupedResourceCounts :: Lens.Lens' GetAggregateDiscoveredResourceCountsResponse (Prelude.Maybe [GroupedResourceCount])
getAggregateDiscoveredResourceCountsResponse_groupedResourceCounts :: (Maybe [GroupedResourceCount] -> f (Maybe [GroupedResourceCount]))
-> GetAggregateDiscoveredResourceCountsResponse
-> f GetAggregateDiscoveredResourceCountsResponse
getAggregateDiscoveredResourceCountsResponse_groupedResourceCounts = (GetAggregateDiscoveredResourceCountsResponse
 -> Maybe [GroupedResourceCount])
-> (GetAggregateDiscoveredResourceCountsResponse
    -> Maybe [GroupedResourceCount]
    -> GetAggregateDiscoveredResourceCountsResponse)
-> Lens
     GetAggregateDiscoveredResourceCountsResponse
     GetAggregateDiscoveredResourceCountsResponse
     (Maybe [GroupedResourceCount])
     (Maybe [GroupedResourceCount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateDiscoveredResourceCountsResponse' {Maybe [GroupedResourceCount]
groupedResourceCounts :: Maybe [GroupedResourceCount]
$sel:groupedResourceCounts:GetAggregateDiscoveredResourceCountsResponse' :: GetAggregateDiscoveredResourceCountsResponse
-> Maybe [GroupedResourceCount]
groupedResourceCounts} -> Maybe [GroupedResourceCount]
groupedResourceCounts) (\s :: GetAggregateDiscoveredResourceCountsResponse
s@GetAggregateDiscoveredResourceCountsResponse' {} Maybe [GroupedResourceCount]
a -> GetAggregateDiscoveredResourceCountsResponse
s {$sel:groupedResourceCounts:GetAggregateDiscoveredResourceCountsResponse' :: Maybe [GroupedResourceCount]
groupedResourceCounts = Maybe [GroupedResourceCount]
a} :: GetAggregateDiscoveredResourceCountsResponse) ((Maybe [GroupedResourceCount] -> f (Maybe [GroupedResourceCount]))
 -> GetAggregateDiscoveredResourceCountsResponse
 -> f GetAggregateDiscoveredResourceCountsResponse)
-> ((Maybe [GroupedResourceCount]
     -> f (Maybe [GroupedResourceCount]))
    -> Maybe [GroupedResourceCount]
    -> f (Maybe [GroupedResourceCount]))
-> (Maybe [GroupedResourceCount]
    -> f (Maybe [GroupedResourceCount]))
-> GetAggregateDiscoveredResourceCountsResponse
-> f GetAggregateDiscoveredResourceCountsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GroupedResourceCount]
  [GroupedResourceCount]
  [GroupedResourceCount]
  [GroupedResourceCount]
-> Iso
     (Maybe [GroupedResourceCount])
     (Maybe [GroupedResourceCount])
     (Maybe [GroupedResourceCount])
     (Maybe [GroupedResourceCount])
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
  [GroupedResourceCount]
  [GroupedResourceCount]
  [GroupedResourceCount]
  [GroupedResourceCount]
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.
getAggregateDiscoveredResourceCountsResponse_nextToken :: Lens.Lens' GetAggregateDiscoveredResourceCountsResponse (Prelude.Maybe Prelude.Text)
getAggregateDiscoveredResourceCountsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetAggregateDiscoveredResourceCountsResponse
-> f GetAggregateDiscoveredResourceCountsResponse
getAggregateDiscoveredResourceCountsResponse_nextToken = (GetAggregateDiscoveredResourceCountsResponse -> Maybe Text)
-> (GetAggregateDiscoveredResourceCountsResponse
    -> Maybe Text -> GetAggregateDiscoveredResourceCountsResponse)
-> Lens
     GetAggregateDiscoveredResourceCountsResponse
     GetAggregateDiscoveredResourceCountsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateDiscoveredResourceCountsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetAggregateDiscoveredResourceCountsResponse' :: GetAggregateDiscoveredResourceCountsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetAggregateDiscoveredResourceCountsResponse
s@GetAggregateDiscoveredResourceCountsResponse' {} Maybe Text
a -> GetAggregateDiscoveredResourceCountsResponse
s {$sel:nextToken:GetAggregateDiscoveredResourceCountsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetAggregateDiscoveredResourceCountsResponse)

-- | The key passed into the request object. If @GroupByKey@ is not provided,
-- the result will be empty.
getAggregateDiscoveredResourceCountsResponse_groupByKey :: Lens.Lens' GetAggregateDiscoveredResourceCountsResponse (Prelude.Maybe Prelude.Text)
getAggregateDiscoveredResourceCountsResponse_groupByKey :: (Maybe Text -> f (Maybe Text))
-> GetAggregateDiscoveredResourceCountsResponse
-> f GetAggregateDiscoveredResourceCountsResponse
getAggregateDiscoveredResourceCountsResponse_groupByKey = (GetAggregateDiscoveredResourceCountsResponse -> Maybe Text)
-> (GetAggregateDiscoveredResourceCountsResponse
    -> Maybe Text -> GetAggregateDiscoveredResourceCountsResponse)
-> Lens
     GetAggregateDiscoveredResourceCountsResponse
     GetAggregateDiscoveredResourceCountsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateDiscoveredResourceCountsResponse' {Maybe Text
groupByKey :: Maybe Text
$sel:groupByKey:GetAggregateDiscoveredResourceCountsResponse' :: GetAggregateDiscoveredResourceCountsResponse -> Maybe Text
groupByKey} -> Maybe Text
groupByKey) (\s :: GetAggregateDiscoveredResourceCountsResponse
s@GetAggregateDiscoveredResourceCountsResponse' {} Maybe Text
a -> GetAggregateDiscoveredResourceCountsResponse
s {$sel:groupByKey:GetAggregateDiscoveredResourceCountsResponse' :: Maybe Text
groupByKey = Maybe Text
a} :: GetAggregateDiscoveredResourceCountsResponse)

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

-- | The total number of resources that are present in an aggregator with the
-- filters that you provide.
getAggregateDiscoveredResourceCountsResponse_totalDiscoveredResources :: Lens.Lens' GetAggregateDiscoveredResourceCountsResponse Prelude.Integer
getAggregateDiscoveredResourceCountsResponse_totalDiscoveredResources :: (Integer -> f Integer)
-> GetAggregateDiscoveredResourceCountsResponse
-> f GetAggregateDiscoveredResourceCountsResponse
getAggregateDiscoveredResourceCountsResponse_totalDiscoveredResources = (GetAggregateDiscoveredResourceCountsResponse -> Integer)
-> (GetAggregateDiscoveredResourceCountsResponse
    -> Integer -> GetAggregateDiscoveredResourceCountsResponse)
-> Lens
     GetAggregateDiscoveredResourceCountsResponse
     GetAggregateDiscoveredResourceCountsResponse
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAggregateDiscoveredResourceCountsResponse' {Integer
totalDiscoveredResources :: Integer
$sel:totalDiscoveredResources:GetAggregateDiscoveredResourceCountsResponse' :: GetAggregateDiscoveredResourceCountsResponse -> Integer
totalDiscoveredResources} -> Integer
totalDiscoveredResources) (\s :: GetAggregateDiscoveredResourceCountsResponse
s@GetAggregateDiscoveredResourceCountsResponse' {} Integer
a -> GetAggregateDiscoveredResourceCountsResponse
s {$sel:totalDiscoveredResources:GetAggregateDiscoveredResourceCountsResponse' :: Integer
totalDiscoveredResources = Integer
a} :: GetAggregateDiscoveredResourceCountsResponse)

instance
  Prelude.NFData
    GetAggregateDiscoveredResourceCountsResponse