{-# 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.Inspector.Types.AssessmentRunAgent
-- 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)
module Amazonka.Inspector.Types.AssessmentRunAgent where

import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types.AgentHealth
import Amazonka.Inspector.Types.AgentHealthCode
import Amazonka.Inspector.Types.TelemetryMetadata
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an Amazon Inspector agent. This data type is
-- used as a response element in the ListAssessmentRunAgents action.
--
-- /See:/ 'newAssessmentRunAgent' smart constructor.
data AssessmentRunAgent = AssessmentRunAgent'
  { -- | The Auto Scaling group of the EC2 instance that is specified by the
    -- agent ID.
    AssessmentRunAgent -> Maybe Text
autoScalingGroup :: Prelude.Maybe Prelude.Text,
    -- | The description for the agent health code.
    AssessmentRunAgent -> Maybe Text
agentHealthDetails :: Prelude.Maybe Prelude.Text,
    -- | The AWS account of the EC2 instance where the agent is installed.
    AssessmentRunAgent -> Text
agentId :: Prelude.Text,
    -- | The ARN of the assessment run that is associated with the agent.
    AssessmentRunAgent -> Text
assessmentRunArn :: Prelude.Text,
    -- | The current health state of the agent.
    AssessmentRunAgent -> AgentHealth
agentHealth :: AgentHealth,
    -- | The detailed health state of the agent.
    AssessmentRunAgent -> AgentHealthCode
agentHealthCode :: AgentHealthCode,
    -- | The Amazon Inspector application data metrics that are collected by the
    -- agent.
    AssessmentRunAgent -> [TelemetryMetadata]
telemetryMetadata :: [TelemetryMetadata]
  }
  deriving (AssessmentRunAgent -> AssessmentRunAgent -> Bool
(AssessmentRunAgent -> AssessmentRunAgent -> Bool)
-> (AssessmentRunAgent -> AssessmentRunAgent -> Bool)
-> Eq AssessmentRunAgent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssessmentRunAgent -> AssessmentRunAgent -> Bool
$c/= :: AssessmentRunAgent -> AssessmentRunAgent -> Bool
== :: AssessmentRunAgent -> AssessmentRunAgent -> Bool
$c== :: AssessmentRunAgent -> AssessmentRunAgent -> Bool
Prelude.Eq, ReadPrec [AssessmentRunAgent]
ReadPrec AssessmentRunAgent
Int -> ReadS AssessmentRunAgent
ReadS [AssessmentRunAgent]
(Int -> ReadS AssessmentRunAgent)
-> ReadS [AssessmentRunAgent]
-> ReadPrec AssessmentRunAgent
-> ReadPrec [AssessmentRunAgent]
-> Read AssessmentRunAgent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssessmentRunAgent]
$creadListPrec :: ReadPrec [AssessmentRunAgent]
readPrec :: ReadPrec AssessmentRunAgent
$creadPrec :: ReadPrec AssessmentRunAgent
readList :: ReadS [AssessmentRunAgent]
$creadList :: ReadS [AssessmentRunAgent]
readsPrec :: Int -> ReadS AssessmentRunAgent
$creadsPrec :: Int -> ReadS AssessmentRunAgent
Prelude.Read, Int -> AssessmentRunAgent -> ShowS
[AssessmentRunAgent] -> ShowS
AssessmentRunAgent -> String
(Int -> AssessmentRunAgent -> ShowS)
-> (AssessmentRunAgent -> String)
-> ([AssessmentRunAgent] -> ShowS)
-> Show AssessmentRunAgent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssessmentRunAgent] -> ShowS
$cshowList :: [AssessmentRunAgent] -> ShowS
show :: AssessmentRunAgent -> String
$cshow :: AssessmentRunAgent -> String
showsPrec :: Int -> AssessmentRunAgent -> ShowS
$cshowsPrec :: Int -> AssessmentRunAgent -> ShowS
Prelude.Show, (forall x. AssessmentRunAgent -> Rep AssessmentRunAgent x)
-> (forall x. Rep AssessmentRunAgent x -> AssessmentRunAgent)
-> Generic AssessmentRunAgent
forall x. Rep AssessmentRunAgent x -> AssessmentRunAgent
forall x. AssessmentRunAgent -> Rep AssessmentRunAgent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssessmentRunAgent x -> AssessmentRunAgent
$cfrom :: forall x. AssessmentRunAgent -> Rep AssessmentRunAgent x
Prelude.Generic)

-- |
-- Create a value of 'AssessmentRunAgent' 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:
--
-- 'autoScalingGroup', 'assessmentRunAgent_autoScalingGroup' - The Auto Scaling group of the EC2 instance that is specified by the
-- agent ID.
--
-- 'agentHealthDetails', 'assessmentRunAgent_agentHealthDetails' - The description for the agent health code.
--
-- 'agentId', 'assessmentRunAgent_agentId' - The AWS account of the EC2 instance where the agent is installed.
--
-- 'assessmentRunArn', 'assessmentRunAgent_assessmentRunArn' - The ARN of the assessment run that is associated with the agent.
--
-- 'agentHealth', 'assessmentRunAgent_agentHealth' - The current health state of the agent.
--
-- 'agentHealthCode', 'assessmentRunAgent_agentHealthCode' - The detailed health state of the agent.
--
-- 'telemetryMetadata', 'assessmentRunAgent_telemetryMetadata' - The Amazon Inspector application data metrics that are collected by the
-- agent.
newAssessmentRunAgent ::
  -- | 'agentId'
  Prelude.Text ->
  -- | 'assessmentRunArn'
  Prelude.Text ->
  -- | 'agentHealth'
  AgentHealth ->
  -- | 'agentHealthCode'
  AgentHealthCode ->
  AssessmentRunAgent
newAssessmentRunAgent :: Text
-> Text -> AgentHealth -> AgentHealthCode -> AssessmentRunAgent
newAssessmentRunAgent
  Text
pAgentId_
  Text
pAssessmentRunArn_
  AgentHealth
pAgentHealth_
  AgentHealthCode
pAgentHealthCode_ =
    AssessmentRunAgent' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> AgentHealth
-> AgentHealthCode
-> [TelemetryMetadata]
-> AssessmentRunAgent
AssessmentRunAgent'
      { $sel:autoScalingGroup:AssessmentRunAgent' :: Maybe Text
autoScalingGroup =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:agentHealthDetails:AssessmentRunAgent' :: Maybe Text
agentHealthDetails = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:agentId:AssessmentRunAgent' :: Text
agentId = Text
pAgentId_,
        $sel:assessmentRunArn:AssessmentRunAgent' :: Text
assessmentRunArn = Text
pAssessmentRunArn_,
        $sel:agentHealth:AssessmentRunAgent' :: AgentHealth
agentHealth = AgentHealth
pAgentHealth_,
        $sel:agentHealthCode:AssessmentRunAgent' :: AgentHealthCode
agentHealthCode = AgentHealthCode
pAgentHealthCode_,
        $sel:telemetryMetadata:AssessmentRunAgent' :: [TelemetryMetadata]
telemetryMetadata = [TelemetryMetadata]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The Auto Scaling group of the EC2 instance that is specified by the
-- agent ID.
assessmentRunAgent_autoScalingGroup :: Lens.Lens' AssessmentRunAgent (Prelude.Maybe Prelude.Text)
assessmentRunAgent_autoScalingGroup :: (Maybe Text -> f (Maybe Text))
-> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_autoScalingGroup = (AssessmentRunAgent -> Maybe Text)
-> (AssessmentRunAgent -> Maybe Text -> AssessmentRunAgent)
-> Lens
     AssessmentRunAgent AssessmentRunAgent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {Maybe Text
autoScalingGroup :: Maybe Text
$sel:autoScalingGroup:AssessmentRunAgent' :: AssessmentRunAgent -> Maybe Text
autoScalingGroup} -> Maybe Text
autoScalingGroup) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} Maybe Text
a -> AssessmentRunAgent
s {$sel:autoScalingGroup:AssessmentRunAgent' :: Maybe Text
autoScalingGroup = Maybe Text
a} :: AssessmentRunAgent)

-- | The description for the agent health code.
assessmentRunAgent_agentHealthDetails :: Lens.Lens' AssessmentRunAgent (Prelude.Maybe Prelude.Text)
assessmentRunAgent_agentHealthDetails :: (Maybe Text -> f (Maybe Text))
-> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_agentHealthDetails = (AssessmentRunAgent -> Maybe Text)
-> (AssessmentRunAgent -> Maybe Text -> AssessmentRunAgent)
-> Lens
     AssessmentRunAgent AssessmentRunAgent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {Maybe Text
agentHealthDetails :: Maybe Text
$sel:agentHealthDetails:AssessmentRunAgent' :: AssessmentRunAgent -> Maybe Text
agentHealthDetails} -> Maybe Text
agentHealthDetails) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} Maybe Text
a -> AssessmentRunAgent
s {$sel:agentHealthDetails:AssessmentRunAgent' :: Maybe Text
agentHealthDetails = Maybe Text
a} :: AssessmentRunAgent)

-- | The AWS account of the EC2 instance where the agent is installed.
assessmentRunAgent_agentId :: Lens.Lens' AssessmentRunAgent Prelude.Text
assessmentRunAgent_agentId :: (Text -> f Text) -> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_agentId = (AssessmentRunAgent -> Text)
-> (AssessmentRunAgent -> Text -> AssessmentRunAgent)
-> Lens AssessmentRunAgent AssessmentRunAgent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {Text
agentId :: Text
$sel:agentId:AssessmentRunAgent' :: AssessmentRunAgent -> Text
agentId} -> Text
agentId) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} Text
a -> AssessmentRunAgent
s {$sel:agentId:AssessmentRunAgent' :: Text
agentId = Text
a} :: AssessmentRunAgent)

-- | The ARN of the assessment run that is associated with the agent.
assessmentRunAgent_assessmentRunArn :: Lens.Lens' AssessmentRunAgent Prelude.Text
assessmentRunAgent_assessmentRunArn :: (Text -> f Text) -> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_assessmentRunArn = (AssessmentRunAgent -> Text)
-> (AssessmentRunAgent -> Text -> AssessmentRunAgent)
-> Lens AssessmentRunAgent AssessmentRunAgent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {Text
assessmentRunArn :: Text
$sel:assessmentRunArn:AssessmentRunAgent' :: AssessmentRunAgent -> Text
assessmentRunArn} -> Text
assessmentRunArn) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} Text
a -> AssessmentRunAgent
s {$sel:assessmentRunArn:AssessmentRunAgent' :: Text
assessmentRunArn = Text
a} :: AssessmentRunAgent)

-- | The current health state of the agent.
assessmentRunAgent_agentHealth :: Lens.Lens' AssessmentRunAgent AgentHealth
assessmentRunAgent_agentHealth :: (AgentHealth -> f AgentHealth)
-> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_agentHealth = (AssessmentRunAgent -> AgentHealth)
-> (AssessmentRunAgent -> AgentHealth -> AssessmentRunAgent)
-> Lens
     AssessmentRunAgent AssessmentRunAgent AgentHealth AgentHealth
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {AgentHealth
agentHealth :: AgentHealth
$sel:agentHealth:AssessmentRunAgent' :: AssessmentRunAgent -> AgentHealth
agentHealth} -> AgentHealth
agentHealth) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} AgentHealth
a -> AssessmentRunAgent
s {$sel:agentHealth:AssessmentRunAgent' :: AgentHealth
agentHealth = AgentHealth
a} :: AssessmentRunAgent)

-- | The detailed health state of the agent.
assessmentRunAgent_agentHealthCode :: Lens.Lens' AssessmentRunAgent AgentHealthCode
assessmentRunAgent_agentHealthCode :: (AgentHealthCode -> f AgentHealthCode)
-> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_agentHealthCode = (AssessmentRunAgent -> AgentHealthCode)
-> (AssessmentRunAgent -> AgentHealthCode -> AssessmentRunAgent)
-> Lens
     AssessmentRunAgent
     AssessmentRunAgent
     AgentHealthCode
     AgentHealthCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {AgentHealthCode
agentHealthCode :: AgentHealthCode
$sel:agentHealthCode:AssessmentRunAgent' :: AssessmentRunAgent -> AgentHealthCode
agentHealthCode} -> AgentHealthCode
agentHealthCode) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} AgentHealthCode
a -> AssessmentRunAgent
s {$sel:agentHealthCode:AssessmentRunAgent' :: AgentHealthCode
agentHealthCode = AgentHealthCode
a} :: AssessmentRunAgent)

-- | The Amazon Inspector application data metrics that are collected by the
-- agent.
assessmentRunAgent_telemetryMetadata :: Lens.Lens' AssessmentRunAgent [TelemetryMetadata]
assessmentRunAgent_telemetryMetadata :: ([TelemetryMetadata] -> f [TelemetryMetadata])
-> AssessmentRunAgent -> f AssessmentRunAgent
assessmentRunAgent_telemetryMetadata = (AssessmentRunAgent -> [TelemetryMetadata])
-> (AssessmentRunAgent
    -> [TelemetryMetadata] -> AssessmentRunAgent)
-> Lens
     AssessmentRunAgent
     AssessmentRunAgent
     [TelemetryMetadata]
     [TelemetryMetadata]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRunAgent' {[TelemetryMetadata]
telemetryMetadata :: [TelemetryMetadata]
$sel:telemetryMetadata:AssessmentRunAgent' :: AssessmentRunAgent -> [TelemetryMetadata]
telemetryMetadata} -> [TelemetryMetadata]
telemetryMetadata) (\s :: AssessmentRunAgent
s@AssessmentRunAgent' {} [TelemetryMetadata]
a -> AssessmentRunAgent
s {$sel:telemetryMetadata:AssessmentRunAgent' :: [TelemetryMetadata]
telemetryMetadata = [TelemetryMetadata]
a} :: AssessmentRunAgent) (([TelemetryMetadata] -> f [TelemetryMetadata])
 -> AssessmentRunAgent -> f AssessmentRunAgent)
-> (([TelemetryMetadata] -> f [TelemetryMetadata])
    -> [TelemetryMetadata] -> f [TelemetryMetadata])
-> ([TelemetryMetadata] -> f [TelemetryMetadata])
-> AssessmentRunAgent
-> f AssessmentRunAgent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TelemetryMetadata] -> f [TelemetryMetadata])
-> [TelemetryMetadata] -> f [TelemetryMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AssessmentRunAgent where
  parseJSON :: Value -> Parser AssessmentRunAgent
parseJSON =
    String
-> (Object -> Parser AssessmentRunAgent)
-> Value
-> Parser AssessmentRunAgent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AssessmentRunAgent"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Text
-> Text
-> AgentHealth
-> AgentHealthCode
-> [TelemetryMetadata]
-> AssessmentRunAgent
AssessmentRunAgent'
            (Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> AgentHealth
 -> AgentHealthCode
 -> [TelemetryMetadata]
 -> AssessmentRunAgent)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text
      -> Text
      -> AgentHealth
      -> AgentHealthCode
      -> [TelemetryMetadata]
      -> AssessmentRunAgent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"autoScalingGroup")
            Parser
  (Maybe Text
   -> Text
   -> Text
   -> AgentHealth
   -> AgentHealthCode
   -> [TelemetryMetadata]
   -> AssessmentRunAgent)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Text
      -> AgentHealth
      -> AgentHealthCode
      -> [TelemetryMetadata]
      -> AssessmentRunAgent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"agentHealthDetails")
            Parser
  (Text
   -> Text
   -> AgentHealth
   -> AgentHealthCode
   -> [TelemetryMetadata]
   -> AssessmentRunAgent)
-> Parser Text
-> Parser
     (Text
      -> AgentHealth
      -> AgentHealthCode
      -> [TelemetryMetadata]
      -> AssessmentRunAgent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"agentId")
            Parser
  (Text
   -> AgentHealth
   -> AgentHealthCode
   -> [TelemetryMetadata]
   -> AssessmentRunAgent)
-> Parser Text
-> Parser
     (AgentHealth
      -> AgentHealthCode -> [TelemetryMetadata] -> AssessmentRunAgent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"assessmentRunArn")
            Parser
  (AgentHealth
   -> AgentHealthCode -> [TelemetryMetadata] -> AssessmentRunAgent)
-> Parser AgentHealth
-> Parser
     (AgentHealthCode -> [TelemetryMetadata] -> AssessmentRunAgent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AgentHealth
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"agentHealth")
            Parser
  (AgentHealthCode -> [TelemetryMetadata] -> AssessmentRunAgent)
-> Parser AgentHealthCode
-> Parser ([TelemetryMetadata] -> AssessmentRunAgent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AgentHealthCode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"agentHealthCode")
            Parser ([TelemetryMetadata] -> AssessmentRunAgent)
-> Parser [TelemetryMetadata] -> Parser AssessmentRunAgent
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [TelemetryMetadata])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"telemetryMetadata"
                            Parser (Maybe [TelemetryMetadata])
-> [TelemetryMetadata] -> Parser [TelemetryMetadata]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [TelemetryMetadata]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AssessmentRunAgent

instance Prelude.NFData AssessmentRunAgent