{-# 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.MacieV2.GetFindingStatistics
-- 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)
--
-- Retrieves (queries) aggregated statistical data about findings.
module Amazonka.MacieV2.GetFindingStatistics
  ( -- * Creating a Request
    GetFindingStatistics (..),
    newGetFindingStatistics,

    -- * Request Lenses
    getFindingStatistics_size,
    getFindingStatistics_findingCriteria,
    getFindingStatistics_sortCriteria,
    getFindingStatistics_groupBy,

    -- * Destructuring the Response
    GetFindingStatisticsResponse (..),
    newGetFindingStatisticsResponse,

    -- * Response Lenses
    getFindingStatisticsResponse_countsByGroup,
    getFindingStatisticsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetFindingStatistics' smart constructor.
data GetFindingStatistics = GetFindingStatistics'
  { -- | The maximum number of items to include in each page of the response.
    GetFindingStatistics -> Maybe Int
size :: Prelude.Maybe Prelude.Int,
    -- | The criteria to use to filter the query results.
    GetFindingStatistics -> Maybe FindingCriteria
findingCriteria :: Prelude.Maybe FindingCriteria,
    -- | The criteria to use to sort the query results.
    GetFindingStatistics -> Maybe FindingStatisticsSortCriteria
sortCriteria :: Prelude.Maybe FindingStatisticsSortCriteria,
    -- | The finding property to use to group the query results. Valid values
    -- are:
    --
    -- -   classificationDetails.jobId - The unique identifier for the
    --     classification job that produced the finding.
    --
    -- -   resourcesAffected.s3Bucket.name - The name of the S3 bucket that the
    --     finding applies to.
    --
    -- -   severity.description - The severity level of the finding, such as
    --     High or Medium.
    --
    -- -   type - The type of finding, such as Policy:IAMUser\/S3BucketPublic
    --     and SensitiveData:S3Object\/Personal.
    GetFindingStatistics -> GroupBy
groupBy :: GroupBy
  }
  deriving (GetFindingStatistics -> GetFindingStatistics -> Bool
(GetFindingStatistics -> GetFindingStatistics -> Bool)
-> (GetFindingStatistics -> GetFindingStatistics -> Bool)
-> Eq GetFindingStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindingStatistics -> GetFindingStatistics -> Bool
$c/= :: GetFindingStatistics -> GetFindingStatistics -> Bool
== :: GetFindingStatistics -> GetFindingStatistics -> Bool
$c== :: GetFindingStatistics -> GetFindingStatistics -> Bool
Prelude.Eq, ReadPrec [GetFindingStatistics]
ReadPrec GetFindingStatistics
Int -> ReadS GetFindingStatistics
ReadS [GetFindingStatistics]
(Int -> ReadS GetFindingStatistics)
-> ReadS [GetFindingStatistics]
-> ReadPrec GetFindingStatistics
-> ReadPrec [GetFindingStatistics]
-> Read GetFindingStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindingStatistics]
$creadListPrec :: ReadPrec [GetFindingStatistics]
readPrec :: ReadPrec GetFindingStatistics
$creadPrec :: ReadPrec GetFindingStatistics
readList :: ReadS [GetFindingStatistics]
$creadList :: ReadS [GetFindingStatistics]
readsPrec :: Int -> ReadS GetFindingStatistics
$creadsPrec :: Int -> ReadS GetFindingStatistics
Prelude.Read, Int -> GetFindingStatistics -> ShowS
[GetFindingStatistics] -> ShowS
GetFindingStatistics -> String
(Int -> GetFindingStatistics -> ShowS)
-> (GetFindingStatistics -> String)
-> ([GetFindingStatistics] -> ShowS)
-> Show GetFindingStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindingStatistics] -> ShowS
$cshowList :: [GetFindingStatistics] -> ShowS
show :: GetFindingStatistics -> String
$cshow :: GetFindingStatistics -> String
showsPrec :: Int -> GetFindingStatistics -> ShowS
$cshowsPrec :: Int -> GetFindingStatistics -> ShowS
Prelude.Show, (forall x. GetFindingStatistics -> Rep GetFindingStatistics x)
-> (forall x. Rep GetFindingStatistics x -> GetFindingStatistics)
-> Generic GetFindingStatistics
forall x. Rep GetFindingStatistics x -> GetFindingStatistics
forall x. GetFindingStatistics -> Rep GetFindingStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFindingStatistics x -> GetFindingStatistics
$cfrom :: forall x. GetFindingStatistics -> Rep GetFindingStatistics x
Prelude.Generic)

-- |
-- Create a value of 'GetFindingStatistics' 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:
--
-- 'size', 'getFindingStatistics_size' - The maximum number of items to include in each page of the response.
--
-- 'findingCriteria', 'getFindingStatistics_findingCriteria' - The criteria to use to filter the query results.
--
-- 'sortCriteria', 'getFindingStatistics_sortCriteria' - The criteria to use to sort the query results.
--
-- 'groupBy', 'getFindingStatistics_groupBy' - The finding property to use to group the query results. Valid values
-- are:
--
-- -   classificationDetails.jobId - The unique identifier for the
--     classification job that produced the finding.
--
-- -   resourcesAffected.s3Bucket.name - The name of the S3 bucket that the
--     finding applies to.
--
-- -   severity.description - The severity level of the finding, such as
--     High or Medium.
--
-- -   type - The type of finding, such as Policy:IAMUser\/S3BucketPublic
--     and SensitiveData:S3Object\/Personal.
newGetFindingStatistics ::
  -- | 'groupBy'
  GroupBy ->
  GetFindingStatistics
newGetFindingStatistics :: GroupBy -> GetFindingStatistics
newGetFindingStatistics GroupBy
pGroupBy_ =
  GetFindingStatistics' :: Maybe Int
-> Maybe FindingCriteria
-> Maybe FindingStatisticsSortCriteria
-> GroupBy
-> GetFindingStatistics
GetFindingStatistics'
    { $sel:size:GetFindingStatistics' :: Maybe Int
size = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:findingCriteria:GetFindingStatistics' :: Maybe FindingCriteria
findingCriteria = Maybe FindingCriteria
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:GetFindingStatistics' :: Maybe FindingStatisticsSortCriteria
sortCriteria = Maybe FindingStatisticsSortCriteria
forall a. Maybe a
Prelude.Nothing,
      $sel:groupBy:GetFindingStatistics' :: GroupBy
groupBy = GroupBy
pGroupBy_
    }

-- | The maximum number of items to include in each page of the response.
getFindingStatistics_size :: Lens.Lens' GetFindingStatistics (Prelude.Maybe Prelude.Int)
getFindingStatistics_size :: (Maybe Int -> f (Maybe Int))
-> GetFindingStatistics -> f GetFindingStatistics
getFindingStatistics_size = (GetFindingStatistics -> Maybe Int)
-> (GetFindingStatistics -> Maybe Int -> GetFindingStatistics)
-> Lens
     GetFindingStatistics GetFindingStatistics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingStatistics' {Maybe Int
size :: Maybe Int
$sel:size:GetFindingStatistics' :: GetFindingStatistics -> Maybe Int
size} -> Maybe Int
size) (\s :: GetFindingStatistics
s@GetFindingStatistics' {} Maybe Int
a -> GetFindingStatistics
s {$sel:size:GetFindingStatistics' :: Maybe Int
size = Maybe Int
a} :: GetFindingStatistics)

-- | The criteria to use to filter the query results.
getFindingStatistics_findingCriteria :: Lens.Lens' GetFindingStatistics (Prelude.Maybe FindingCriteria)
getFindingStatistics_findingCriteria :: (Maybe FindingCriteria -> f (Maybe FindingCriteria))
-> GetFindingStatistics -> f GetFindingStatistics
getFindingStatistics_findingCriteria = (GetFindingStatistics -> Maybe FindingCriteria)
-> (GetFindingStatistics
    -> Maybe FindingCriteria -> GetFindingStatistics)
-> Lens
     GetFindingStatistics
     GetFindingStatistics
     (Maybe FindingCriteria)
     (Maybe FindingCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingStatistics' {Maybe FindingCriteria
findingCriteria :: Maybe FindingCriteria
$sel:findingCriteria:GetFindingStatistics' :: GetFindingStatistics -> Maybe FindingCriteria
findingCriteria} -> Maybe FindingCriteria
findingCriteria) (\s :: GetFindingStatistics
s@GetFindingStatistics' {} Maybe FindingCriteria
a -> GetFindingStatistics
s {$sel:findingCriteria:GetFindingStatistics' :: Maybe FindingCriteria
findingCriteria = Maybe FindingCriteria
a} :: GetFindingStatistics)

-- | The criteria to use to sort the query results.
getFindingStatistics_sortCriteria :: Lens.Lens' GetFindingStatistics (Prelude.Maybe FindingStatisticsSortCriteria)
getFindingStatistics_sortCriteria :: (Maybe FindingStatisticsSortCriteria
 -> f (Maybe FindingStatisticsSortCriteria))
-> GetFindingStatistics -> f GetFindingStatistics
getFindingStatistics_sortCriteria = (GetFindingStatistics -> Maybe FindingStatisticsSortCriteria)
-> (GetFindingStatistics
    -> Maybe FindingStatisticsSortCriteria -> GetFindingStatistics)
-> Lens
     GetFindingStatistics
     GetFindingStatistics
     (Maybe FindingStatisticsSortCriteria)
     (Maybe FindingStatisticsSortCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingStatistics' {Maybe FindingStatisticsSortCriteria
sortCriteria :: Maybe FindingStatisticsSortCriteria
$sel:sortCriteria:GetFindingStatistics' :: GetFindingStatistics -> Maybe FindingStatisticsSortCriteria
sortCriteria} -> Maybe FindingStatisticsSortCriteria
sortCriteria) (\s :: GetFindingStatistics
s@GetFindingStatistics' {} Maybe FindingStatisticsSortCriteria
a -> GetFindingStatistics
s {$sel:sortCriteria:GetFindingStatistics' :: Maybe FindingStatisticsSortCriteria
sortCriteria = Maybe FindingStatisticsSortCriteria
a} :: GetFindingStatistics)

-- | The finding property to use to group the query results. Valid values
-- are:
--
-- -   classificationDetails.jobId - The unique identifier for the
--     classification job that produced the finding.
--
-- -   resourcesAffected.s3Bucket.name - The name of the S3 bucket that the
--     finding applies to.
--
-- -   severity.description - The severity level of the finding, such as
--     High or Medium.
--
-- -   type - The type of finding, such as Policy:IAMUser\/S3BucketPublic
--     and SensitiveData:S3Object\/Personal.
getFindingStatistics_groupBy :: Lens.Lens' GetFindingStatistics GroupBy
getFindingStatistics_groupBy :: (GroupBy -> f GroupBy)
-> GetFindingStatistics -> f GetFindingStatistics
getFindingStatistics_groupBy = (GetFindingStatistics -> GroupBy)
-> (GetFindingStatistics -> GroupBy -> GetFindingStatistics)
-> Lens GetFindingStatistics GetFindingStatistics GroupBy GroupBy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingStatistics' {GroupBy
groupBy :: GroupBy
$sel:groupBy:GetFindingStatistics' :: GetFindingStatistics -> GroupBy
groupBy} -> GroupBy
groupBy) (\s :: GetFindingStatistics
s@GetFindingStatistics' {} GroupBy
a -> GetFindingStatistics
s {$sel:groupBy:GetFindingStatistics' :: GroupBy
groupBy = GroupBy
a} :: GetFindingStatistics)

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

instance Prelude.NFData GetFindingStatistics

instance Core.ToHeaders GetFindingStatistics where
  toHeaders :: GetFindingStatistics -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetFindingStatistics -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 GetFindingStatistics where
  toJSON :: GetFindingStatistics -> Value
toJSON GetFindingStatistics' {Maybe Int
Maybe FindingCriteria
Maybe FindingStatisticsSortCriteria
GroupBy
groupBy :: GroupBy
sortCriteria :: Maybe FindingStatisticsSortCriteria
findingCriteria :: Maybe FindingCriteria
size :: Maybe Int
$sel:groupBy:GetFindingStatistics' :: GetFindingStatistics -> GroupBy
$sel:sortCriteria:GetFindingStatistics' :: GetFindingStatistics -> Maybe FindingStatisticsSortCriteria
$sel:findingCriteria:GetFindingStatistics' :: GetFindingStatistics -> Maybe FindingCriteria
$sel:size:GetFindingStatistics' :: GetFindingStatistics -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"size" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
size,
            (Key
"findingCriteria" Key -> FindingCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=)
              (FindingCriteria -> Pair) -> Maybe FindingCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingCriteria
findingCriteria,
            (Key
"sortCriteria" Key -> FindingStatisticsSortCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=) (FindingStatisticsSortCriteria -> Pair)
-> Maybe FindingStatisticsSortCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingStatisticsSortCriteria
sortCriteria,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Key
"groupBy" Key -> GroupBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= GroupBy
groupBy)
          ]
      )

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

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

-- | /See:/ 'newGetFindingStatisticsResponse' smart constructor.
data GetFindingStatisticsResponse = GetFindingStatisticsResponse'
  { -- | An array of objects, one for each group of findings that meet the filter
    -- criteria specified in the request.
    GetFindingStatisticsResponse -> Maybe [GroupCount]
countsByGroup :: Prelude.Maybe [GroupCount],
    -- | The response's http status code.
    GetFindingStatisticsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetFindingStatisticsResponse
-> GetFindingStatisticsResponse -> Bool
(GetFindingStatisticsResponse
 -> GetFindingStatisticsResponse -> Bool)
-> (GetFindingStatisticsResponse
    -> GetFindingStatisticsResponse -> Bool)
-> Eq GetFindingStatisticsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindingStatisticsResponse
-> GetFindingStatisticsResponse -> Bool
$c/= :: GetFindingStatisticsResponse
-> GetFindingStatisticsResponse -> Bool
== :: GetFindingStatisticsResponse
-> GetFindingStatisticsResponse -> Bool
$c== :: GetFindingStatisticsResponse
-> GetFindingStatisticsResponse -> Bool
Prelude.Eq, ReadPrec [GetFindingStatisticsResponse]
ReadPrec GetFindingStatisticsResponse
Int -> ReadS GetFindingStatisticsResponse
ReadS [GetFindingStatisticsResponse]
(Int -> ReadS GetFindingStatisticsResponse)
-> ReadS [GetFindingStatisticsResponse]
-> ReadPrec GetFindingStatisticsResponse
-> ReadPrec [GetFindingStatisticsResponse]
-> Read GetFindingStatisticsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindingStatisticsResponse]
$creadListPrec :: ReadPrec [GetFindingStatisticsResponse]
readPrec :: ReadPrec GetFindingStatisticsResponse
$creadPrec :: ReadPrec GetFindingStatisticsResponse
readList :: ReadS [GetFindingStatisticsResponse]
$creadList :: ReadS [GetFindingStatisticsResponse]
readsPrec :: Int -> ReadS GetFindingStatisticsResponse
$creadsPrec :: Int -> ReadS GetFindingStatisticsResponse
Prelude.Read, Int -> GetFindingStatisticsResponse -> ShowS
[GetFindingStatisticsResponse] -> ShowS
GetFindingStatisticsResponse -> String
(Int -> GetFindingStatisticsResponse -> ShowS)
-> (GetFindingStatisticsResponse -> String)
-> ([GetFindingStatisticsResponse] -> ShowS)
-> Show GetFindingStatisticsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindingStatisticsResponse] -> ShowS
$cshowList :: [GetFindingStatisticsResponse] -> ShowS
show :: GetFindingStatisticsResponse -> String
$cshow :: GetFindingStatisticsResponse -> String
showsPrec :: Int -> GetFindingStatisticsResponse -> ShowS
$cshowsPrec :: Int -> GetFindingStatisticsResponse -> ShowS
Prelude.Show, (forall x.
 GetFindingStatisticsResponse -> Rep GetFindingStatisticsResponse x)
-> (forall x.
    Rep GetFindingStatisticsResponse x -> GetFindingStatisticsResponse)
-> Generic GetFindingStatisticsResponse
forall x.
Rep GetFindingStatisticsResponse x -> GetFindingStatisticsResponse
forall x.
GetFindingStatisticsResponse -> Rep GetFindingStatisticsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFindingStatisticsResponse x -> GetFindingStatisticsResponse
$cfrom :: forall x.
GetFindingStatisticsResponse -> Rep GetFindingStatisticsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFindingStatisticsResponse' 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:
--
-- 'countsByGroup', 'getFindingStatisticsResponse_countsByGroup' - An array of objects, one for each group of findings that meet the filter
-- criteria specified in the request.
--
-- 'httpStatus', 'getFindingStatisticsResponse_httpStatus' - The response's http status code.
newGetFindingStatisticsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFindingStatisticsResponse
newGetFindingStatisticsResponse :: Int -> GetFindingStatisticsResponse
newGetFindingStatisticsResponse Int
pHttpStatus_ =
  GetFindingStatisticsResponse' :: Maybe [GroupCount] -> Int -> GetFindingStatisticsResponse
GetFindingStatisticsResponse'
    { $sel:countsByGroup:GetFindingStatisticsResponse' :: Maybe [GroupCount]
countsByGroup =
        Maybe [GroupCount]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetFindingStatisticsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects, one for each group of findings that meet the filter
-- criteria specified in the request.
getFindingStatisticsResponse_countsByGroup :: Lens.Lens' GetFindingStatisticsResponse (Prelude.Maybe [GroupCount])
getFindingStatisticsResponse_countsByGroup :: (Maybe [GroupCount] -> f (Maybe [GroupCount]))
-> GetFindingStatisticsResponse -> f GetFindingStatisticsResponse
getFindingStatisticsResponse_countsByGroup = (GetFindingStatisticsResponse -> Maybe [GroupCount])
-> (GetFindingStatisticsResponse
    -> Maybe [GroupCount] -> GetFindingStatisticsResponse)
-> Lens
     GetFindingStatisticsResponse
     GetFindingStatisticsResponse
     (Maybe [GroupCount])
     (Maybe [GroupCount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingStatisticsResponse' {Maybe [GroupCount]
countsByGroup :: Maybe [GroupCount]
$sel:countsByGroup:GetFindingStatisticsResponse' :: GetFindingStatisticsResponse -> Maybe [GroupCount]
countsByGroup} -> Maybe [GroupCount]
countsByGroup) (\s :: GetFindingStatisticsResponse
s@GetFindingStatisticsResponse' {} Maybe [GroupCount]
a -> GetFindingStatisticsResponse
s {$sel:countsByGroup:GetFindingStatisticsResponse' :: Maybe [GroupCount]
countsByGroup = Maybe [GroupCount]
a} :: GetFindingStatisticsResponse) ((Maybe [GroupCount] -> f (Maybe [GroupCount]))
 -> GetFindingStatisticsResponse -> f GetFindingStatisticsResponse)
-> ((Maybe [GroupCount] -> f (Maybe [GroupCount]))
    -> Maybe [GroupCount] -> f (Maybe [GroupCount]))
-> (Maybe [GroupCount] -> f (Maybe [GroupCount]))
-> GetFindingStatisticsResponse
-> f GetFindingStatisticsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [GroupCount] [GroupCount] [GroupCount] [GroupCount]
-> Iso
     (Maybe [GroupCount])
     (Maybe [GroupCount])
     (Maybe [GroupCount])
     (Maybe [GroupCount])
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 [GroupCount] [GroupCount] [GroupCount] [GroupCount]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetFindingStatisticsResponse