{-# 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.GetDiscoveredResourceCounts
-- 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 types, the number of each resource type, and the
-- total number of resources that Config is recording in this region for
-- your Amazon Web Services account.
--
-- __Example__
--
-- 1.  Config is recording three resource types in the US East (Ohio)
--     Region for your account: 25 EC2 instances, 20 IAM users, and 15 S3
--     buckets.
--
-- 2.  You make a call to the @GetDiscoveredResourceCounts@ action and
--     specify that you want all resource types.
--
-- 3.  Config returns the following:
--
--     -   The resource types (EC2 instances, IAM users, and S3 buckets).
--
--     -   The number of each resource type (25, 20, and 15).
--
--     -   The total number of all resources (60).
--
-- The response is paginated. By default, Config lists 100 ResourceCount
-- objects on each page. You can customize this number with the @limit@
-- parameter. The response includes a @nextToken@ string. To get the next
-- page of results, run the request again and specify the string for the
-- @nextToken@ parameter.
--
-- If you make a call to the GetDiscoveredResourceCounts action, you might
-- not immediately receive resource counts in the following situations:
--
-- -   You are a new Config customer.
--
-- -   You just enabled resource recording.
--
-- It might take a few minutes for Config to record and count your
-- resources. Wait a few minutes and then retry the
-- GetDiscoveredResourceCounts action.
module Amazonka.Config.GetDiscoveredResourceCounts
  ( -- * Creating a Request
    GetDiscoveredResourceCounts (..),
    newGetDiscoveredResourceCounts,

    -- * Request Lenses
    getDiscoveredResourceCounts_nextToken,
    getDiscoveredResourceCounts_limit,
    getDiscoveredResourceCounts_resourceTypes,

    -- * Destructuring the Response
    GetDiscoveredResourceCountsResponse (..),
    newGetDiscoveredResourceCountsResponse,

    -- * Response Lenses
    getDiscoveredResourceCountsResponse_totalDiscoveredResources,
    getDiscoveredResourceCountsResponse_nextToken,
    getDiscoveredResourceCountsResponse_resourceCounts,
    getDiscoveredResourceCountsResponse_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:/ 'newGetDiscoveredResourceCounts' smart constructor.
data GetDiscoveredResourceCounts = GetDiscoveredResourceCounts'
  { -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    GetDiscoveredResourceCounts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of ResourceCount objects returned on each page. The
    -- default is 100. You cannot specify a number greater than 100. If you
    -- specify 0, Config uses the default.
    GetDiscoveredResourceCounts -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The comma-separated list that specifies the resource types that you want
    -- Config to return (for example, @\"AWS::EC2::Instance\"@,
    -- @\"AWS::IAM::User\"@).
    --
    -- If a value for @resourceTypes@ is not specified, Config returns all
    -- resource types that Config is recording in the region for your account.
    --
    -- If the configuration recorder is turned off, Config returns an empty
    -- list of ResourceCount objects. If the configuration recorder is not
    -- recording a specific resource type (for example, S3 buckets), that
    -- resource type is not returned in the list of ResourceCount objects.
    GetDiscoveredResourceCounts -> Maybe [Text]
resourceTypes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (GetDiscoveredResourceCounts -> GetDiscoveredResourceCounts -> Bool
(GetDiscoveredResourceCounts
 -> GetDiscoveredResourceCounts -> Bool)
-> (GetDiscoveredResourceCounts
    -> GetDiscoveredResourceCounts -> Bool)
-> Eq GetDiscoveredResourceCounts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDiscoveredResourceCounts -> GetDiscoveredResourceCounts -> Bool
$c/= :: GetDiscoveredResourceCounts -> GetDiscoveredResourceCounts -> Bool
== :: GetDiscoveredResourceCounts -> GetDiscoveredResourceCounts -> Bool
$c== :: GetDiscoveredResourceCounts -> GetDiscoveredResourceCounts -> Bool
Prelude.Eq, ReadPrec [GetDiscoveredResourceCounts]
ReadPrec GetDiscoveredResourceCounts
Int -> ReadS GetDiscoveredResourceCounts
ReadS [GetDiscoveredResourceCounts]
(Int -> ReadS GetDiscoveredResourceCounts)
-> ReadS [GetDiscoveredResourceCounts]
-> ReadPrec GetDiscoveredResourceCounts
-> ReadPrec [GetDiscoveredResourceCounts]
-> Read GetDiscoveredResourceCounts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDiscoveredResourceCounts]
$creadListPrec :: ReadPrec [GetDiscoveredResourceCounts]
readPrec :: ReadPrec GetDiscoveredResourceCounts
$creadPrec :: ReadPrec GetDiscoveredResourceCounts
readList :: ReadS [GetDiscoveredResourceCounts]
$creadList :: ReadS [GetDiscoveredResourceCounts]
readsPrec :: Int -> ReadS GetDiscoveredResourceCounts
$creadsPrec :: Int -> ReadS GetDiscoveredResourceCounts
Prelude.Read, Int -> GetDiscoveredResourceCounts -> ShowS
[GetDiscoveredResourceCounts] -> ShowS
GetDiscoveredResourceCounts -> String
(Int -> GetDiscoveredResourceCounts -> ShowS)
-> (GetDiscoveredResourceCounts -> String)
-> ([GetDiscoveredResourceCounts] -> ShowS)
-> Show GetDiscoveredResourceCounts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDiscoveredResourceCounts] -> ShowS
$cshowList :: [GetDiscoveredResourceCounts] -> ShowS
show :: GetDiscoveredResourceCounts -> String
$cshow :: GetDiscoveredResourceCounts -> String
showsPrec :: Int -> GetDiscoveredResourceCounts -> ShowS
$cshowsPrec :: Int -> GetDiscoveredResourceCounts -> ShowS
Prelude.Show, (forall x.
 GetDiscoveredResourceCounts -> Rep GetDiscoveredResourceCounts x)
-> (forall x.
    Rep GetDiscoveredResourceCounts x -> GetDiscoveredResourceCounts)
-> Generic GetDiscoveredResourceCounts
forall x.
Rep GetDiscoveredResourceCounts x -> GetDiscoveredResourceCounts
forall x.
GetDiscoveredResourceCounts -> Rep GetDiscoveredResourceCounts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDiscoveredResourceCounts x -> GetDiscoveredResourceCounts
$cfrom :: forall x.
GetDiscoveredResourceCounts -> Rep GetDiscoveredResourceCounts x
Prelude.Generic)

-- |
-- Create a value of 'GetDiscoveredResourceCounts' 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', 'getDiscoveredResourceCounts_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'getDiscoveredResourceCounts_limit' - The maximum number of ResourceCount objects returned on each page. The
-- default is 100. You cannot specify a number greater than 100. If you
-- specify 0, Config uses the default.
--
-- 'resourceTypes', 'getDiscoveredResourceCounts_resourceTypes' - The comma-separated list that specifies the resource types that you want
-- Config to return (for example, @\"AWS::EC2::Instance\"@,
-- @\"AWS::IAM::User\"@).
--
-- If a value for @resourceTypes@ is not specified, Config returns all
-- resource types that Config is recording in the region for your account.
--
-- If the configuration recorder is turned off, Config returns an empty
-- list of ResourceCount objects. If the configuration recorder is not
-- recording a specific resource type (for example, S3 buckets), that
-- resource type is not returned in the list of ResourceCount objects.
newGetDiscoveredResourceCounts ::
  GetDiscoveredResourceCounts
newGetDiscoveredResourceCounts :: GetDiscoveredResourceCounts
newGetDiscoveredResourceCounts =
  GetDiscoveredResourceCounts' :: Maybe Text
-> Maybe Natural -> Maybe [Text] -> GetDiscoveredResourceCounts
GetDiscoveredResourceCounts'
    { $sel:nextToken:GetDiscoveredResourceCounts' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:GetDiscoveredResourceCounts' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTypes:GetDiscoveredResourceCounts' :: Maybe [Text]
resourceTypes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The comma-separated list that specifies the resource types that you want
-- Config to return (for example, @\"AWS::EC2::Instance\"@,
-- @\"AWS::IAM::User\"@).
--
-- If a value for @resourceTypes@ is not specified, Config returns all
-- resource types that Config is recording in the region for your account.
--
-- If the configuration recorder is turned off, Config returns an empty
-- list of ResourceCount objects. If the configuration recorder is not
-- recording a specific resource type (for example, S3 buckets), that
-- resource type is not returned in the list of ResourceCount objects.
getDiscoveredResourceCounts_resourceTypes :: Lens.Lens' GetDiscoveredResourceCounts (Prelude.Maybe [Prelude.Text])
getDiscoveredResourceCounts_resourceTypes :: (Maybe [Text] -> f (Maybe [Text]))
-> GetDiscoveredResourceCounts -> f GetDiscoveredResourceCounts
getDiscoveredResourceCounts_resourceTypes = (GetDiscoveredResourceCounts -> Maybe [Text])
-> (GetDiscoveredResourceCounts
    -> Maybe [Text] -> GetDiscoveredResourceCounts)
-> Lens
     GetDiscoveredResourceCounts
     GetDiscoveredResourceCounts
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredResourceCounts' {Maybe [Text]
resourceTypes :: Maybe [Text]
$sel:resourceTypes:GetDiscoveredResourceCounts' :: GetDiscoveredResourceCounts -> Maybe [Text]
resourceTypes} -> Maybe [Text]
resourceTypes) (\s :: GetDiscoveredResourceCounts
s@GetDiscoveredResourceCounts' {} Maybe [Text]
a -> GetDiscoveredResourceCounts
s {$sel:resourceTypes:GetDiscoveredResourceCounts' :: Maybe [Text]
resourceTypes = Maybe [Text]
a} :: GetDiscoveredResourceCounts) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetDiscoveredResourceCounts -> f GetDiscoveredResourceCounts)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetDiscoveredResourceCounts
-> f GetDiscoveredResourceCounts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetDiscoveredResourceCounts

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

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

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

-- | /See:/ 'newGetDiscoveredResourceCountsResponse' smart constructor.
data GetDiscoveredResourceCountsResponse = GetDiscoveredResourceCountsResponse'
  { -- | The total number of resources that Config is recording in the region for
    -- your account. If you specify resource types in the request, Config
    -- returns only the total number of resources for those resource types.
    --
    -- __Example__
    --
    -- 1.  Config is recording three resource types in the US East (Ohio)
    --     Region for your account: 25 EC2 instances, 20 IAM users, and 15 S3
    --     buckets, for a total of 60 resources.
    --
    -- 2.  You make a call to the @GetDiscoveredResourceCounts@ action and
    --     specify the resource type, @\"AWS::EC2::Instances\"@, in the
    --     request.
    --
    -- 3.  Config returns 25 for @totalDiscoveredResources@.
    GetDiscoveredResourceCountsResponse -> Maybe Integer
totalDiscoveredResources :: Prelude.Maybe Prelude.Integer,
    -- | The string that you use in a subsequent request to get the next page of
    -- results in a paginated response.
    GetDiscoveredResourceCountsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of @ResourceCount@ objects. Each object is listed in descending
    -- order by the number of resources.
    GetDiscoveredResourceCountsResponse -> Maybe [ResourceCount]
resourceCounts :: Prelude.Maybe [ResourceCount],
    -- | The response's http status code.
    GetDiscoveredResourceCountsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDiscoveredResourceCountsResponse
-> GetDiscoveredResourceCountsResponse -> Bool
(GetDiscoveredResourceCountsResponse
 -> GetDiscoveredResourceCountsResponse -> Bool)
-> (GetDiscoveredResourceCountsResponse
    -> GetDiscoveredResourceCountsResponse -> Bool)
-> Eq GetDiscoveredResourceCountsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDiscoveredResourceCountsResponse
-> GetDiscoveredResourceCountsResponse -> Bool
$c/= :: GetDiscoveredResourceCountsResponse
-> GetDiscoveredResourceCountsResponse -> Bool
== :: GetDiscoveredResourceCountsResponse
-> GetDiscoveredResourceCountsResponse -> Bool
$c== :: GetDiscoveredResourceCountsResponse
-> GetDiscoveredResourceCountsResponse -> Bool
Prelude.Eq, ReadPrec [GetDiscoveredResourceCountsResponse]
ReadPrec GetDiscoveredResourceCountsResponse
Int -> ReadS GetDiscoveredResourceCountsResponse
ReadS [GetDiscoveredResourceCountsResponse]
(Int -> ReadS GetDiscoveredResourceCountsResponse)
-> ReadS [GetDiscoveredResourceCountsResponse]
-> ReadPrec GetDiscoveredResourceCountsResponse
-> ReadPrec [GetDiscoveredResourceCountsResponse]
-> Read GetDiscoveredResourceCountsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDiscoveredResourceCountsResponse]
$creadListPrec :: ReadPrec [GetDiscoveredResourceCountsResponse]
readPrec :: ReadPrec GetDiscoveredResourceCountsResponse
$creadPrec :: ReadPrec GetDiscoveredResourceCountsResponse
readList :: ReadS [GetDiscoveredResourceCountsResponse]
$creadList :: ReadS [GetDiscoveredResourceCountsResponse]
readsPrec :: Int -> ReadS GetDiscoveredResourceCountsResponse
$creadsPrec :: Int -> ReadS GetDiscoveredResourceCountsResponse
Prelude.Read, Int -> GetDiscoveredResourceCountsResponse -> ShowS
[GetDiscoveredResourceCountsResponse] -> ShowS
GetDiscoveredResourceCountsResponse -> String
(Int -> GetDiscoveredResourceCountsResponse -> ShowS)
-> (GetDiscoveredResourceCountsResponse -> String)
-> ([GetDiscoveredResourceCountsResponse] -> ShowS)
-> Show GetDiscoveredResourceCountsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDiscoveredResourceCountsResponse] -> ShowS
$cshowList :: [GetDiscoveredResourceCountsResponse] -> ShowS
show :: GetDiscoveredResourceCountsResponse -> String
$cshow :: GetDiscoveredResourceCountsResponse -> String
showsPrec :: Int -> GetDiscoveredResourceCountsResponse -> ShowS
$cshowsPrec :: Int -> GetDiscoveredResourceCountsResponse -> ShowS
Prelude.Show, (forall x.
 GetDiscoveredResourceCountsResponse
 -> Rep GetDiscoveredResourceCountsResponse x)
-> (forall x.
    Rep GetDiscoveredResourceCountsResponse x
    -> GetDiscoveredResourceCountsResponse)
-> Generic GetDiscoveredResourceCountsResponse
forall x.
Rep GetDiscoveredResourceCountsResponse x
-> GetDiscoveredResourceCountsResponse
forall x.
GetDiscoveredResourceCountsResponse
-> Rep GetDiscoveredResourceCountsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDiscoveredResourceCountsResponse x
-> GetDiscoveredResourceCountsResponse
$cfrom :: forall x.
GetDiscoveredResourceCountsResponse
-> Rep GetDiscoveredResourceCountsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDiscoveredResourceCountsResponse' 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:
--
-- 'totalDiscoveredResources', 'getDiscoveredResourceCountsResponse_totalDiscoveredResources' - The total number of resources that Config is recording in the region for
-- your account. If you specify resource types in the request, Config
-- returns only the total number of resources for those resource types.
--
-- __Example__
--
-- 1.  Config is recording three resource types in the US East (Ohio)
--     Region for your account: 25 EC2 instances, 20 IAM users, and 15 S3
--     buckets, for a total of 60 resources.
--
-- 2.  You make a call to the @GetDiscoveredResourceCounts@ action and
--     specify the resource type, @\"AWS::EC2::Instances\"@, in the
--     request.
--
-- 3.  Config returns 25 for @totalDiscoveredResources@.
--
-- 'nextToken', 'getDiscoveredResourceCountsResponse_nextToken' - The string that you use in a subsequent request to get the next page of
-- results in a paginated response.
--
-- 'resourceCounts', 'getDiscoveredResourceCountsResponse_resourceCounts' - The list of @ResourceCount@ objects. Each object is listed in descending
-- order by the number of resources.
--
-- 'httpStatus', 'getDiscoveredResourceCountsResponse_httpStatus' - The response's http status code.
newGetDiscoveredResourceCountsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDiscoveredResourceCountsResponse
newGetDiscoveredResourceCountsResponse :: Int -> GetDiscoveredResourceCountsResponse
newGetDiscoveredResourceCountsResponse Int
pHttpStatus_ =
  GetDiscoveredResourceCountsResponse' :: Maybe Integer
-> Maybe Text
-> Maybe [ResourceCount]
-> Int
-> GetDiscoveredResourceCountsResponse
GetDiscoveredResourceCountsResponse'
    { $sel:totalDiscoveredResources:GetDiscoveredResourceCountsResponse' :: Maybe Integer
totalDiscoveredResources =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetDiscoveredResourceCountsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceCounts:GetDiscoveredResourceCountsResponse' :: Maybe [ResourceCount]
resourceCounts = Maybe [ResourceCount]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDiscoveredResourceCountsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The total number of resources that Config is recording in the region for
-- your account. If you specify resource types in the request, Config
-- returns only the total number of resources for those resource types.
--
-- __Example__
--
-- 1.  Config is recording three resource types in the US East (Ohio)
--     Region for your account: 25 EC2 instances, 20 IAM users, and 15 S3
--     buckets, for a total of 60 resources.
--
-- 2.  You make a call to the @GetDiscoveredResourceCounts@ action and
--     specify the resource type, @\"AWS::EC2::Instances\"@, in the
--     request.
--
-- 3.  Config returns 25 for @totalDiscoveredResources@.
getDiscoveredResourceCountsResponse_totalDiscoveredResources :: Lens.Lens' GetDiscoveredResourceCountsResponse (Prelude.Maybe Prelude.Integer)
getDiscoveredResourceCountsResponse_totalDiscoveredResources :: (Maybe Integer -> f (Maybe Integer))
-> GetDiscoveredResourceCountsResponse
-> f GetDiscoveredResourceCountsResponse
getDiscoveredResourceCountsResponse_totalDiscoveredResources = (GetDiscoveredResourceCountsResponse -> Maybe Integer)
-> (GetDiscoveredResourceCountsResponse
    -> Maybe Integer -> GetDiscoveredResourceCountsResponse)
-> Lens
     GetDiscoveredResourceCountsResponse
     GetDiscoveredResourceCountsResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredResourceCountsResponse' {Maybe Integer
totalDiscoveredResources :: Maybe Integer
$sel:totalDiscoveredResources:GetDiscoveredResourceCountsResponse' :: GetDiscoveredResourceCountsResponse -> Maybe Integer
totalDiscoveredResources} -> Maybe Integer
totalDiscoveredResources) (\s :: GetDiscoveredResourceCountsResponse
s@GetDiscoveredResourceCountsResponse' {} Maybe Integer
a -> GetDiscoveredResourceCountsResponse
s {$sel:totalDiscoveredResources:GetDiscoveredResourceCountsResponse' :: Maybe Integer
totalDiscoveredResources = Maybe Integer
a} :: GetDiscoveredResourceCountsResponse)

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

-- | The list of @ResourceCount@ objects. Each object is listed in descending
-- order by the number of resources.
getDiscoveredResourceCountsResponse_resourceCounts :: Lens.Lens' GetDiscoveredResourceCountsResponse (Prelude.Maybe [ResourceCount])
getDiscoveredResourceCountsResponse_resourceCounts :: (Maybe [ResourceCount] -> f (Maybe [ResourceCount]))
-> GetDiscoveredResourceCountsResponse
-> f GetDiscoveredResourceCountsResponse
getDiscoveredResourceCountsResponse_resourceCounts = (GetDiscoveredResourceCountsResponse -> Maybe [ResourceCount])
-> (GetDiscoveredResourceCountsResponse
    -> Maybe [ResourceCount] -> GetDiscoveredResourceCountsResponse)
-> Lens
     GetDiscoveredResourceCountsResponse
     GetDiscoveredResourceCountsResponse
     (Maybe [ResourceCount])
     (Maybe [ResourceCount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredResourceCountsResponse' {Maybe [ResourceCount]
resourceCounts :: Maybe [ResourceCount]
$sel:resourceCounts:GetDiscoveredResourceCountsResponse' :: GetDiscoveredResourceCountsResponse -> Maybe [ResourceCount]
resourceCounts} -> Maybe [ResourceCount]
resourceCounts) (\s :: GetDiscoveredResourceCountsResponse
s@GetDiscoveredResourceCountsResponse' {} Maybe [ResourceCount]
a -> GetDiscoveredResourceCountsResponse
s {$sel:resourceCounts:GetDiscoveredResourceCountsResponse' :: Maybe [ResourceCount]
resourceCounts = Maybe [ResourceCount]
a} :: GetDiscoveredResourceCountsResponse) ((Maybe [ResourceCount] -> f (Maybe [ResourceCount]))
 -> GetDiscoveredResourceCountsResponse
 -> f GetDiscoveredResourceCountsResponse)
-> ((Maybe [ResourceCount] -> f (Maybe [ResourceCount]))
    -> Maybe [ResourceCount] -> f (Maybe [ResourceCount]))
-> (Maybe [ResourceCount] -> f (Maybe [ResourceCount]))
-> GetDiscoveredResourceCountsResponse
-> f GetDiscoveredResourceCountsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceCount] [ResourceCount] [ResourceCount] [ResourceCount]
-> Iso
     (Maybe [ResourceCount])
     (Maybe [ResourceCount])
     (Maybe [ResourceCount])
     (Maybe [ResourceCount])
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
  [ResourceCount] [ResourceCount] [ResourceCount] [ResourceCount]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetDiscoveredResourceCountsResponse