{-# 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.AgentPreview
-- 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.AgentPreview where

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

-- | Used as a response element in the PreviewAgents action.
--
-- /See:/ 'newAgentPreview' smart constructor.
data AgentPreview = AgentPreview'
  { -- | The hostname of the EC2 instance on which the Amazon Inspector Agent is
    -- installed.
    AgentPreview -> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
    -- | The Auto Scaling group for the EC2 instance where the agent is
    -- installed.
    AgentPreview -> Maybe Text
autoScalingGroup :: Prelude.Maybe Prelude.Text,
    -- | The operating system running on the EC2 instance on which the Amazon
    -- Inspector Agent is installed.
    AgentPreview -> Maybe Text
operatingSystem :: Prelude.Maybe Prelude.Text,
    -- | The version of the Amazon Inspector Agent.
    AgentPreview -> Maybe Text
agentVersion :: Prelude.Maybe Prelude.Text,
    -- | The kernel version of the operating system running on the EC2 instance
    -- on which the Amazon Inspector Agent is installed.
    AgentPreview -> Maybe Text
kernelVersion :: Prelude.Maybe Prelude.Text,
    -- | The health status of the Amazon Inspector Agent.
    AgentPreview -> Maybe AgentHealth
agentHealth :: Prelude.Maybe AgentHealth,
    -- | The IP address of the EC2 instance on which the Amazon Inspector Agent
    -- is installed.
    AgentPreview -> Maybe Text
ipv4Address :: Prelude.Maybe Prelude.Text,
    -- | The ID of the EC2 instance where the agent is installed.
    AgentPreview -> Text
agentId :: Prelude.Text
  }
  deriving (AgentPreview -> AgentPreview -> Bool
(AgentPreview -> AgentPreview -> Bool)
-> (AgentPreview -> AgentPreview -> Bool) -> Eq AgentPreview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AgentPreview -> AgentPreview -> Bool
$c/= :: AgentPreview -> AgentPreview -> Bool
== :: AgentPreview -> AgentPreview -> Bool
$c== :: AgentPreview -> AgentPreview -> Bool
Prelude.Eq, ReadPrec [AgentPreview]
ReadPrec AgentPreview
Int -> ReadS AgentPreview
ReadS [AgentPreview]
(Int -> ReadS AgentPreview)
-> ReadS [AgentPreview]
-> ReadPrec AgentPreview
-> ReadPrec [AgentPreview]
-> Read AgentPreview
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AgentPreview]
$creadListPrec :: ReadPrec [AgentPreview]
readPrec :: ReadPrec AgentPreview
$creadPrec :: ReadPrec AgentPreview
readList :: ReadS [AgentPreview]
$creadList :: ReadS [AgentPreview]
readsPrec :: Int -> ReadS AgentPreview
$creadsPrec :: Int -> ReadS AgentPreview
Prelude.Read, Int -> AgentPreview -> ShowS
[AgentPreview] -> ShowS
AgentPreview -> String
(Int -> AgentPreview -> ShowS)
-> (AgentPreview -> String)
-> ([AgentPreview] -> ShowS)
-> Show AgentPreview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AgentPreview] -> ShowS
$cshowList :: [AgentPreview] -> ShowS
show :: AgentPreview -> String
$cshow :: AgentPreview -> String
showsPrec :: Int -> AgentPreview -> ShowS
$cshowsPrec :: Int -> AgentPreview -> ShowS
Prelude.Show, (forall x. AgentPreview -> Rep AgentPreview x)
-> (forall x. Rep AgentPreview x -> AgentPreview)
-> Generic AgentPreview
forall x. Rep AgentPreview x -> AgentPreview
forall x. AgentPreview -> Rep AgentPreview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AgentPreview x -> AgentPreview
$cfrom :: forall x. AgentPreview -> Rep AgentPreview x
Prelude.Generic)

-- |
-- Create a value of 'AgentPreview' 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:
--
-- 'hostname', 'agentPreview_hostname' - The hostname of the EC2 instance on which the Amazon Inspector Agent is
-- installed.
--
-- 'autoScalingGroup', 'agentPreview_autoScalingGroup' - The Auto Scaling group for the EC2 instance where the agent is
-- installed.
--
-- 'operatingSystem', 'agentPreview_operatingSystem' - The operating system running on the EC2 instance on which the Amazon
-- Inspector Agent is installed.
--
-- 'agentVersion', 'agentPreview_agentVersion' - The version of the Amazon Inspector Agent.
--
-- 'kernelVersion', 'agentPreview_kernelVersion' - The kernel version of the operating system running on the EC2 instance
-- on which the Amazon Inspector Agent is installed.
--
-- 'agentHealth', 'agentPreview_agentHealth' - The health status of the Amazon Inspector Agent.
--
-- 'ipv4Address', 'agentPreview_ipv4Address' - The IP address of the EC2 instance on which the Amazon Inspector Agent
-- is installed.
--
-- 'agentId', 'agentPreview_agentId' - The ID of the EC2 instance where the agent is installed.
newAgentPreview ::
  -- | 'agentId'
  Prelude.Text ->
  AgentPreview
newAgentPreview :: Text -> AgentPreview
newAgentPreview Text
pAgentId_ =
  AgentPreview' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AgentHealth
-> Maybe Text
-> Text
-> AgentPreview
AgentPreview'
    { $sel:hostname:AgentPreview' :: Maybe Text
hostname = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroup:AgentPreview' :: Maybe Text
autoScalingGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operatingSystem:AgentPreview' :: Maybe Text
operatingSystem = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:agentVersion:AgentPreview' :: Maybe Text
agentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kernelVersion:AgentPreview' :: Maybe Text
kernelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:agentHealth:AgentPreview' :: Maybe AgentHealth
agentHealth = Maybe AgentHealth
forall a. Maybe a
Prelude.Nothing,
      $sel:ipv4Address:AgentPreview' :: Maybe Text
ipv4Address = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:agentId:AgentPreview' :: Text
agentId = Text
pAgentId_
    }

-- | The hostname of the EC2 instance on which the Amazon Inspector Agent is
-- installed.
agentPreview_hostname :: Lens.Lens' AgentPreview (Prelude.Maybe Prelude.Text)
agentPreview_hostname :: (Maybe Text -> f (Maybe Text)) -> AgentPreview -> f AgentPreview
agentPreview_hostname = (AgentPreview -> Maybe Text)
-> (AgentPreview -> Maybe Text -> AgentPreview)
-> Lens AgentPreview AgentPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe Text
hostname :: Maybe Text
$sel:hostname:AgentPreview' :: AgentPreview -> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: AgentPreview
s@AgentPreview' {} Maybe Text
a -> AgentPreview
s {$sel:hostname:AgentPreview' :: Maybe Text
hostname = Maybe Text
a} :: AgentPreview)

-- | The Auto Scaling group for the EC2 instance where the agent is
-- installed.
agentPreview_autoScalingGroup :: Lens.Lens' AgentPreview (Prelude.Maybe Prelude.Text)
agentPreview_autoScalingGroup :: (Maybe Text -> f (Maybe Text)) -> AgentPreview -> f AgentPreview
agentPreview_autoScalingGroup = (AgentPreview -> Maybe Text)
-> (AgentPreview -> Maybe Text -> AgentPreview)
-> Lens AgentPreview AgentPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe Text
autoScalingGroup :: Maybe Text
$sel:autoScalingGroup:AgentPreview' :: AgentPreview -> Maybe Text
autoScalingGroup} -> Maybe Text
autoScalingGroup) (\s :: AgentPreview
s@AgentPreview' {} Maybe Text
a -> AgentPreview
s {$sel:autoScalingGroup:AgentPreview' :: Maybe Text
autoScalingGroup = Maybe Text
a} :: AgentPreview)

-- | The operating system running on the EC2 instance on which the Amazon
-- Inspector Agent is installed.
agentPreview_operatingSystem :: Lens.Lens' AgentPreview (Prelude.Maybe Prelude.Text)
agentPreview_operatingSystem :: (Maybe Text -> f (Maybe Text)) -> AgentPreview -> f AgentPreview
agentPreview_operatingSystem = (AgentPreview -> Maybe Text)
-> (AgentPreview -> Maybe Text -> AgentPreview)
-> Lens AgentPreview AgentPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe Text
operatingSystem :: Maybe Text
$sel:operatingSystem:AgentPreview' :: AgentPreview -> Maybe Text
operatingSystem} -> Maybe Text
operatingSystem) (\s :: AgentPreview
s@AgentPreview' {} Maybe Text
a -> AgentPreview
s {$sel:operatingSystem:AgentPreview' :: Maybe Text
operatingSystem = Maybe Text
a} :: AgentPreview)

-- | The version of the Amazon Inspector Agent.
agentPreview_agentVersion :: Lens.Lens' AgentPreview (Prelude.Maybe Prelude.Text)
agentPreview_agentVersion :: (Maybe Text -> f (Maybe Text)) -> AgentPreview -> f AgentPreview
agentPreview_agentVersion = (AgentPreview -> Maybe Text)
-> (AgentPreview -> Maybe Text -> AgentPreview)
-> Lens AgentPreview AgentPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe Text
agentVersion :: Maybe Text
$sel:agentVersion:AgentPreview' :: AgentPreview -> Maybe Text
agentVersion} -> Maybe Text
agentVersion) (\s :: AgentPreview
s@AgentPreview' {} Maybe Text
a -> AgentPreview
s {$sel:agentVersion:AgentPreview' :: Maybe Text
agentVersion = Maybe Text
a} :: AgentPreview)

-- | The kernel version of the operating system running on the EC2 instance
-- on which the Amazon Inspector Agent is installed.
agentPreview_kernelVersion :: Lens.Lens' AgentPreview (Prelude.Maybe Prelude.Text)
agentPreview_kernelVersion :: (Maybe Text -> f (Maybe Text)) -> AgentPreview -> f AgentPreview
agentPreview_kernelVersion = (AgentPreview -> Maybe Text)
-> (AgentPreview -> Maybe Text -> AgentPreview)
-> Lens AgentPreview AgentPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe Text
kernelVersion :: Maybe Text
$sel:kernelVersion:AgentPreview' :: AgentPreview -> Maybe Text
kernelVersion} -> Maybe Text
kernelVersion) (\s :: AgentPreview
s@AgentPreview' {} Maybe Text
a -> AgentPreview
s {$sel:kernelVersion:AgentPreview' :: Maybe Text
kernelVersion = Maybe Text
a} :: AgentPreview)

-- | The health status of the Amazon Inspector Agent.
agentPreview_agentHealth :: Lens.Lens' AgentPreview (Prelude.Maybe AgentHealth)
agentPreview_agentHealth :: (Maybe AgentHealth -> f (Maybe AgentHealth))
-> AgentPreview -> f AgentPreview
agentPreview_agentHealth = (AgentPreview -> Maybe AgentHealth)
-> (AgentPreview -> Maybe AgentHealth -> AgentPreview)
-> Lens
     AgentPreview AgentPreview (Maybe AgentHealth) (Maybe AgentHealth)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe AgentHealth
agentHealth :: Maybe AgentHealth
$sel:agentHealth:AgentPreview' :: AgentPreview -> Maybe AgentHealth
agentHealth} -> Maybe AgentHealth
agentHealth) (\s :: AgentPreview
s@AgentPreview' {} Maybe AgentHealth
a -> AgentPreview
s {$sel:agentHealth:AgentPreview' :: Maybe AgentHealth
agentHealth = Maybe AgentHealth
a} :: AgentPreview)

-- | The IP address of the EC2 instance on which the Amazon Inspector Agent
-- is installed.
agentPreview_ipv4Address :: Lens.Lens' AgentPreview (Prelude.Maybe Prelude.Text)
agentPreview_ipv4Address :: (Maybe Text -> f (Maybe Text)) -> AgentPreview -> f AgentPreview
agentPreview_ipv4Address = (AgentPreview -> Maybe Text)
-> (AgentPreview -> Maybe Text -> AgentPreview)
-> Lens AgentPreview AgentPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentPreview' {Maybe Text
ipv4Address :: Maybe Text
$sel:ipv4Address:AgentPreview' :: AgentPreview -> Maybe Text
ipv4Address} -> Maybe Text
ipv4Address) (\s :: AgentPreview
s@AgentPreview' {} Maybe Text
a -> AgentPreview
s {$sel:ipv4Address:AgentPreview' :: Maybe Text
ipv4Address = Maybe Text
a} :: AgentPreview)

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

instance Core.FromJSON AgentPreview where
  parseJSON :: Value -> Parser AgentPreview
parseJSON =
    String
-> (Object -> Parser AgentPreview) -> Value -> Parser AgentPreview
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AgentPreview"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AgentHealth
-> Maybe Text
-> Text
-> AgentPreview
AgentPreview'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe AgentHealth
 -> Maybe Text
 -> Text
 -> AgentPreview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AgentHealth
      -> Maybe Text
      -> Text
      -> AgentPreview)
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
"hostname")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AgentHealth
   -> Maybe Text
   -> Text
   -> AgentPreview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AgentHealth
      -> Maybe Text
      -> Text
      -> AgentPreview)
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
"autoScalingGroup")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AgentHealth
   -> Maybe Text
   -> Text
   -> AgentPreview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe AgentHealth
      -> Maybe Text
      -> Text
      -> AgentPreview)
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
"operatingSystem")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe AgentHealth
   -> Maybe Text
   -> Text
   -> AgentPreview)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe AgentHealth -> Maybe Text -> Text -> AgentPreview)
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
"agentVersion")
            Parser
  (Maybe Text
   -> Maybe AgentHealth -> Maybe Text -> Text -> AgentPreview)
-> Parser (Maybe Text)
-> Parser (Maybe AgentHealth -> Maybe Text -> Text -> AgentPreview)
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
"kernelVersion")
            Parser (Maybe AgentHealth -> Maybe Text -> Text -> AgentPreview)
-> Parser (Maybe AgentHealth)
-> Parser (Maybe Text -> Text -> AgentPreview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AgentHealth)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"agentHealth")
            Parser (Maybe Text -> Text -> AgentPreview)
-> Parser (Maybe Text) -> Parser (Text -> AgentPreview)
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
"ipv4Address")
            Parser (Text -> AgentPreview) -> Parser Text -> Parser AgentPreview
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")
      )

instance Prelude.Hashable AgentPreview

instance Prelude.NFData AgentPreview