{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Inspector2.Types.LambdaFunctionAggregationResponse
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector2.Types.LambdaFunctionAggregationResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.SeverityCounts
import qualified Amazonka.Prelude as Prelude

-- | A response that contains the results of an AWS Lambda function finding
-- aggregation.
--
-- /See:/ 'newLambdaFunctionAggregationResponse' smart constructor.
data LambdaFunctionAggregationResponse = LambdaFunctionAggregationResponse'
  { -- | The ID of the AWS account that owns the AWS Lambda function.
    LambdaFunctionAggregationResponse -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The AWS Lambda function names included in the aggregation results.
    LambdaFunctionAggregationResponse -> Maybe Text
functionName :: Prelude.Maybe Prelude.Text,
    -- | The tags included in the aggregation results.
    LambdaFunctionAggregationResponse -> Maybe (HashMap Text Text)
lambdaTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The date that the AWS Lambda function included in the aggregation
    -- results was last changed.
    LambdaFunctionAggregationResponse -> Maybe POSIX
lastModifiedAt :: Prelude.Maybe Data.POSIX,
    -- | The runtimes included in the aggregation results.
    LambdaFunctionAggregationResponse -> Maybe Text
runtime :: Prelude.Maybe Prelude.Text,
    LambdaFunctionAggregationResponse -> Maybe SeverityCounts
severityCounts :: Prelude.Maybe SeverityCounts,
    -- | The resource IDs included in the aggregation results.
    LambdaFunctionAggregationResponse -> Text
resourceId :: Prelude.Text
  }
  deriving (LambdaFunctionAggregationResponse
-> LambdaFunctionAggregationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionAggregationResponse
-> LambdaFunctionAggregationResponse -> Bool
$c/= :: LambdaFunctionAggregationResponse
-> LambdaFunctionAggregationResponse -> Bool
== :: LambdaFunctionAggregationResponse
-> LambdaFunctionAggregationResponse -> Bool
$c== :: LambdaFunctionAggregationResponse
-> LambdaFunctionAggregationResponse -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionAggregationResponse]
ReadPrec LambdaFunctionAggregationResponse
Int -> ReadS LambdaFunctionAggregationResponse
ReadS [LambdaFunctionAggregationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionAggregationResponse]
$creadListPrec :: ReadPrec [LambdaFunctionAggregationResponse]
readPrec :: ReadPrec LambdaFunctionAggregationResponse
$creadPrec :: ReadPrec LambdaFunctionAggregationResponse
readList :: ReadS [LambdaFunctionAggregationResponse]
$creadList :: ReadS [LambdaFunctionAggregationResponse]
readsPrec :: Int -> ReadS LambdaFunctionAggregationResponse
$creadsPrec :: Int -> ReadS LambdaFunctionAggregationResponse
Prelude.Read, Int -> LambdaFunctionAggregationResponse -> ShowS
[LambdaFunctionAggregationResponse] -> ShowS
LambdaFunctionAggregationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionAggregationResponse] -> ShowS
$cshowList :: [LambdaFunctionAggregationResponse] -> ShowS
show :: LambdaFunctionAggregationResponse -> String
$cshow :: LambdaFunctionAggregationResponse -> String
showsPrec :: Int -> LambdaFunctionAggregationResponse -> ShowS
$cshowsPrec :: Int -> LambdaFunctionAggregationResponse -> ShowS
Prelude.Show, forall x.
Rep LambdaFunctionAggregationResponse x
-> LambdaFunctionAggregationResponse
forall x.
LambdaFunctionAggregationResponse
-> Rep LambdaFunctionAggregationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionAggregationResponse x
-> LambdaFunctionAggregationResponse
$cfrom :: forall x.
LambdaFunctionAggregationResponse
-> Rep LambdaFunctionAggregationResponse x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionAggregationResponse' 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:
--
-- 'accountId', 'lambdaFunctionAggregationResponse_accountId' - The ID of the AWS account that owns the AWS Lambda function.
--
-- 'functionName', 'lambdaFunctionAggregationResponse_functionName' - The AWS Lambda function names included in the aggregation results.
--
-- 'lambdaTags', 'lambdaFunctionAggregationResponse_lambdaTags' - The tags included in the aggregation results.
--
-- 'lastModifiedAt', 'lambdaFunctionAggregationResponse_lastModifiedAt' - The date that the AWS Lambda function included in the aggregation
-- results was last changed.
--
-- 'runtime', 'lambdaFunctionAggregationResponse_runtime' - The runtimes included in the aggregation results.
--
-- 'severityCounts', 'lambdaFunctionAggregationResponse_severityCounts' - Undocumented member.
--
-- 'resourceId', 'lambdaFunctionAggregationResponse_resourceId' - The resource IDs included in the aggregation results.
newLambdaFunctionAggregationResponse ::
  -- | 'resourceId'
  Prelude.Text ->
  LambdaFunctionAggregationResponse
newLambdaFunctionAggregationResponse :: Text -> LambdaFunctionAggregationResponse
newLambdaFunctionAggregationResponse Text
pResourceId_ =
  LambdaFunctionAggregationResponse'
    { $sel:accountId:LambdaFunctionAggregationResponse' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:functionName:LambdaFunctionAggregationResponse' :: Maybe Text
functionName = forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaTags:LambdaFunctionAggregationResponse' :: Maybe (HashMap Text Text)
lambdaTags = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedAt:LambdaFunctionAggregationResponse' :: Maybe POSIX
lastModifiedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:runtime:LambdaFunctionAggregationResponse' :: Maybe Text
runtime = forall a. Maybe a
Prelude.Nothing,
      $sel:severityCounts:LambdaFunctionAggregationResponse' :: Maybe SeverityCounts
severityCounts = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:LambdaFunctionAggregationResponse' :: Text
resourceId = Text
pResourceId_
    }

-- | The ID of the AWS account that owns the AWS Lambda function.
lambdaFunctionAggregationResponse_accountId :: Lens.Lens' LambdaFunctionAggregationResponse (Prelude.Maybe Prelude.Text)
lambdaFunctionAggregationResponse_accountId :: Lens' LambdaFunctionAggregationResponse (Maybe Text)
lambdaFunctionAggregationResponse_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Maybe Text
accountId :: Maybe Text
$sel:accountId:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Maybe Text
a -> LambdaFunctionAggregationResponse
s {$sel:accountId:LambdaFunctionAggregationResponse' :: Maybe Text
accountId = Maybe Text
a} :: LambdaFunctionAggregationResponse)

-- | The AWS Lambda function names included in the aggregation results.
lambdaFunctionAggregationResponse_functionName :: Lens.Lens' LambdaFunctionAggregationResponse (Prelude.Maybe Prelude.Text)
lambdaFunctionAggregationResponse_functionName :: Lens' LambdaFunctionAggregationResponse (Maybe Text)
lambdaFunctionAggregationResponse_functionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Maybe Text
functionName :: Maybe Text
$sel:functionName:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
functionName} -> Maybe Text
functionName) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Maybe Text
a -> LambdaFunctionAggregationResponse
s {$sel:functionName:LambdaFunctionAggregationResponse' :: Maybe Text
functionName = Maybe Text
a} :: LambdaFunctionAggregationResponse)

-- | The tags included in the aggregation results.
lambdaFunctionAggregationResponse_lambdaTags :: Lens.Lens' LambdaFunctionAggregationResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
lambdaFunctionAggregationResponse_lambdaTags :: Lens' LambdaFunctionAggregationResponse (Maybe (HashMap Text Text))
lambdaFunctionAggregationResponse_lambdaTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Maybe (HashMap Text Text)
lambdaTags :: Maybe (HashMap Text Text)
$sel:lambdaTags:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe (HashMap Text Text)
lambdaTags} -> Maybe (HashMap Text Text)
lambdaTags) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Maybe (HashMap Text Text)
a -> LambdaFunctionAggregationResponse
s {$sel:lambdaTags:LambdaFunctionAggregationResponse' :: Maybe (HashMap Text Text)
lambdaTags = Maybe (HashMap Text Text)
a} :: LambdaFunctionAggregationResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date that the AWS Lambda function included in the aggregation
-- results was last changed.
lambdaFunctionAggregationResponse_lastModifiedAt :: Lens.Lens' LambdaFunctionAggregationResponse (Prelude.Maybe Prelude.UTCTime)
lambdaFunctionAggregationResponse_lastModifiedAt :: Lens' LambdaFunctionAggregationResponse (Maybe UTCTime)
lambdaFunctionAggregationResponse_lastModifiedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Maybe POSIX
lastModifiedAt :: Maybe POSIX
$sel:lastModifiedAt:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe POSIX
lastModifiedAt} -> Maybe POSIX
lastModifiedAt) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Maybe POSIX
a -> LambdaFunctionAggregationResponse
s {$sel:lastModifiedAt:LambdaFunctionAggregationResponse' :: Maybe POSIX
lastModifiedAt = Maybe POSIX
a} :: LambdaFunctionAggregationResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The runtimes included in the aggregation results.
lambdaFunctionAggregationResponse_runtime :: Lens.Lens' LambdaFunctionAggregationResponse (Prelude.Maybe Prelude.Text)
lambdaFunctionAggregationResponse_runtime :: Lens' LambdaFunctionAggregationResponse (Maybe Text)
lambdaFunctionAggregationResponse_runtime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Maybe Text
runtime :: Maybe Text
$sel:runtime:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
runtime} -> Maybe Text
runtime) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Maybe Text
a -> LambdaFunctionAggregationResponse
s {$sel:runtime:LambdaFunctionAggregationResponse' :: Maybe Text
runtime = Maybe Text
a} :: LambdaFunctionAggregationResponse)

-- | Undocumented member.
lambdaFunctionAggregationResponse_severityCounts :: Lens.Lens' LambdaFunctionAggregationResponse (Prelude.Maybe SeverityCounts)
lambdaFunctionAggregationResponse_severityCounts :: Lens' LambdaFunctionAggregationResponse (Maybe SeverityCounts)
lambdaFunctionAggregationResponse_severityCounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Maybe SeverityCounts
severityCounts :: Maybe SeverityCounts
$sel:severityCounts:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe SeverityCounts
severityCounts} -> Maybe SeverityCounts
severityCounts) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Maybe SeverityCounts
a -> LambdaFunctionAggregationResponse
s {$sel:severityCounts:LambdaFunctionAggregationResponse' :: Maybe SeverityCounts
severityCounts = Maybe SeverityCounts
a} :: LambdaFunctionAggregationResponse)

-- | The resource IDs included in the aggregation results.
lambdaFunctionAggregationResponse_resourceId :: Lens.Lens' LambdaFunctionAggregationResponse Prelude.Text
lambdaFunctionAggregationResponse_resourceId :: Lens' LambdaFunctionAggregationResponse Text
lambdaFunctionAggregationResponse_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAggregationResponse' {Text
resourceId :: Text
$sel:resourceId:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Text
resourceId} -> Text
resourceId) (\s :: LambdaFunctionAggregationResponse
s@LambdaFunctionAggregationResponse' {} Text
a -> LambdaFunctionAggregationResponse
s {$sel:resourceId:LambdaFunctionAggregationResponse' :: Text
resourceId = Text
a} :: LambdaFunctionAggregationResponse)

instance
  Data.FromJSON
    LambdaFunctionAggregationResponse
  where
  parseJSON :: Value -> Parser LambdaFunctionAggregationResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LambdaFunctionAggregationResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe POSIX
-> Maybe Text
-> Maybe SeverityCounts
-> Text
-> LambdaFunctionAggregationResponse
LambdaFunctionAggregationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"accountId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"functionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lambdaTags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastModifiedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"runtime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"severityCounts")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceId")
      )

instance
  Prelude.Hashable
    LambdaFunctionAggregationResponse
  where
  hashWithSalt :: Int -> LambdaFunctionAggregationResponse -> Int
hashWithSalt
    Int
_salt
    LambdaFunctionAggregationResponse' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe SeverityCounts
Text
resourceId :: Text
severityCounts :: Maybe SeverityCounts
runtime :: Maybe Text
lastModifiedAt :: Maybe POSIX
lambdaTags :: Maybe (HashMap Text Text)
functionName :: Maybe Text
accountId :: Maybe Text
$sel:resourceId:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Text
$sel:severityCounts:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe SeverityCounts
$sel:runtime:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
$sel:lastModifiedAt:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe POSIX
$sel:lambdaTags:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe (HashMap Text Text)
$sel:functionName:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
$sel:accountId:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
functionName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
lambdaTags
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedAt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
runtime
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SeverityCounts
severityCounts
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId

instance
  Prelude.NFData
    LambdaFunctionAggregationResponse
  where
  rnf :: LambdaFunctionAggregationResponse -> ()
rnf LambdaFunctionAggregationResponse' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe SeverityCounts
Text
resourceId :: Text
severityCounts :: Maybe SeverityCounts
runtime :: Maybe Text
lastModifiedAt :: Maybe POSIX
lambdaTags :: Maybe (HashMap Text Text)
functionName :: Maybe Text
accountId :: Maybe Text
$sel:resourceId:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Text
$sel:severityCounts:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe SeverityCounts
$sel:runtime:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
$sel:lastModifiedAt:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe POSIX
$sel:lambdaTags:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe (HashMap Text Text)
$sel:functionName:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
$sel:accountId:LambdaFunctionAggregationResponse' :: LambdaFunctionAggregationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
functionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
lambdaTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
runtime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SeverityCounts
severityCounts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId