{-# 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.SSM.Types.PatchComplianceData
-- 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.SSM.Types.PatchComplianceData where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.PatchComplianceDataState

-- | Information about the state of a patch on a particular managed node as
-- it relates to the patch baseline used to patch the node.
--
-- /See:/ 'newPatchComplianceData' smart constructor.
data PatchComplianceData = PatchComplianceData'
  { -- | The IDs of one or more Common Vulnerabilities and Exposure (CVE) issues
    -- that are resolved by the patch.
    PatchComplianceData -> Maybe Text
cVEIds :: Prelude.Maybe Prelude.Text,
    -- | The title of the patch.
    PatchComplianceData -> Text
title :: Prelude.Text,
    -- | The operating system-specific ID of the patch.
    PatchComplianceData -> Text
kBId :: Prelude.Text,
    -- | The classification of the patch, such as @SecurityUpdates@, @Updates@,
    -- and @CriticalUpdates@.
    PatchComplianceData -> Text
classification :: Prelude.Text,
    -- | The severity of the patch such as @Critical@, @Important@, and
    -- @Moderate@.
    PatchComplianceData -> Text
severity :: Prelude.Text,
    -- | The state of the patch on the managed node, such as INSTALLED or FAILED.
    --
    -- For descriptions of each patch state, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-compliance-about.html#sysman-compliance-monitor-patch About patch compliance>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    PatchComplianceData -> PatchComplianceDataState
state :: PatchComplianceDataState,
    -- | The date\/time the patch was installed on the managed node. Not all
    -- operating systems provide this level of information.
    PatchComplianceData -> POSIX
installedTime :: Data.POSIX
  }
  deriving (PatchComplianceData -> PatchComplianceData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchComplianceData -> PatchComplianceData -> Bool
$c/= :: PatchComplianceData -> PatchComplianceData -> Bool
== :: PatchComplianceData -> PatchComplianceData -> Bool
$c== :: PatchComplianceData -> PatchComplianceData -> Bool
Prelude.Eq, ReadPrec [PatchComplianceData]
ReadPrec PatchComplianceData
Int -> ReadS PatchComplianceData
ReadS [PatchComplianceData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchComplianceData]
$creadListPrec :: ReadPrec [PatchComplianceData]
readPrec :: ReadPrec PatchComplianceData
$creadPrec :: ReadPrec PatchComplianceData
readList :: ReadS [PatchComplianceData]
$creadList :: ReadS [PatchComplianceData]
readsPrec :: Int -> ReadS PatchComplianceData
$creadsPrec :: Int -> ReadS PatchComplianceData
Prelude.Read, Int -> PatchComplianceData -> ShowS
[PatchComplianceData] -> ShowS
PatchComplianceData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchComplianceData] -> ShowS
$cshowList :: [PatchComplianceData] -> ShowS
show :: PatchComplianceData -> String
$cshow :: PatchComplianceData -> String
showsPrec :: Int -> PatchComplianceData -> ShowS
$cshowsPrec :: Int -> PatchComplianceData -> ShowS
Prelude.Show, forall x. Rep PatchComplianceData x -> PatchComplianceData
forall x. PatchComplianceData -> Rep PatchComplianceData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchComplianceData x -> PatchComplianceData
$cfrom :: forall x. PatchComplianceData -> Rep PatchComplianceData x
Prelude.Generic)

-- |
-- Create a value of 'PatchComplianceData' 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:
--
-- 'cVEIds', 'patchComplianceData_cVEIds' - The IDs of one or more Common Vulnerabilities and Exposure (CVE) issues
-- that are resolved by the patch.
--
-- 'title', 'patchComplianceData_title' - The title of the patch.
--
-- 'kBId', 'patchComplianceData_kBId' - The operating system-specific ID of the patch.
--
-- 'classification', 'patchComplianceData_classification' - The classification of the patch, such as @SecurityUpdates@, @Updates@,
-- and @CriticalUpdates@.
--
-- 'severity', 'patchComplianceData_severity' - The severity of the patch such as @Critical@, @Important@, and
-- @Moderate@.
--
-- 'state', 'patchComplianceData_state' - The state of the patch on the managed node, such as INSTALLED or FAILED.
--
-- For descriptions of each patch state, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-compliance-about.html#sysman-compliance-monitor-patch About patch compliance>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'installedTime', 'patchComplianceData_installedTime' - The date\/time the patch was installed on the managed node. Not all
-- operating systems provide this level of information.
newPatchComplianceData ::
  -- | 'title'
  Prelude.Text ->
  -- | 'kBId'
  Prelude.Text ->
  -- | 'classification'
  Prelude.Text ->
  -- | 'severity'
  Prelude.Text ->
  -- | 'state'
  PatchComplianceDataState ->
  -- | 'installedTime'
  Prelude.UTCTime ->
  PatchComplianceData
newPatchComplianceData :: Text
-> Text
-> Text
-> Text
-> PatchComplianceDataState
-> UTCTime
-> PatchComplianceData
newPatchComplianceData
  Text
pTitle_
  Text
pKBId_
  Text
pClassification_
  Text
pSeverity_
  PatchComplianceDataState
pState_
  UTCTime
pInstalledTime_ =
    PatchComplianceData'
      { $sel:cVEIds:PatchComplianceData' :: Maybe Text
cVEIds = forall a. Maybe a
Prelude.Nothing,
        $sel:title:PatchComplianceData' :: Text
title = Text
pTitle_,
        $sel:kBId:PatchComplianceData' :: Text
kBId = Text
pKBId_,
        $sel:classification:PatchComplianceData' :: Text
classification = Text
pClassification_,
        $sel:severity:PatchComplianceData' :: Text
severity = Text
pSeverity_,
        $sel:state:PatchComplianceData' :: PatchComplianceDataState
state = PatchComplianceDataState
pState_,
        $sel:installedTime:PatchComplianceData' :: POSIX
installedTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pInstalledTime_
      }

-- | The IDs of one or more Common Vulnerabilities and Exposure (CVE) issues
-- that are resolved by the patch.
patchComplianceData_cVEIds :: Lens.Lens' PatchComplianceData (Prelude.Maybe Prelude.Text)
patchComplianceData_cVEIds :: Lens' PatchComplianceData (Maybe Text)
patchComplianceData_cVEIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {Maybe Text
cVEIds :: Maybe Text
$sel:cVEIds:PatchComplianceData' :: PatchComplianceData -> Maybe Text
cVEIds} -> Maybe Text
cVEIds) (\s :: PatchComplianceData
s@PatchComplianceData' {} Maybe Text
a -> PatchComplianceData
s {$sel:cVEIds:PatchComplianceData' :: Maybe Text
cVEIds = Maybe Text
a} :: PatchComplianceData)

-- | The title of the patch.
patchComplianceData_title :: Lens.Lens' PatchComplianceData Prelude.Text
patchComplianceData_title :: Lens' PatchComplianceData Text
patchComplianceData_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {Text
title :: Text
$sel:title:PatchComplianceData' :: PatchComplianceData -> Text
title} -> Text
title) (\s :: PatchComplianceData
s@PatchComplianceData' {} Text
a -> PatchComplianceData
s {$sel:title:PatchComplianceData' :: Text
title = Text
a} :: PatchComplianceData)

-- | The operating system-specific ID of the patch.
patchComplianceData_kBId :: Lens.Lens' PatchComplianceData Prelude.Text
patchComplianceData_kBId :: Lens' PatchComplianceData Text
patchComplianceData_kBId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {Text
kBId :: Text
$sel:kBId:PatchComplianceData' :: PatchComplianceData -> Text
kBId} -> Text
kBId) (\s :: PatchComplianceData
s@PatchComplianceData' {} Text
a -> PatchComplianceData
s {$sel:kBId:PatchComplianceData' :: Text
kBId = Text
a} :: PatchComplianceData)

-- | The classification of the patch, such as @SecurityUpdates@, @Updates@,
-- and @CriticalUpdates@.
patchComplianceData_classification :: Lens.Lens' PatchComplianceData Prelude.Text
patchComplianceData_classification :: Lens' PatchComplianceData Text
patchComplianceData_classification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {Text
classification :: Text
$sel:classification:PatchComplianceData' :: PatchComplianceData -> Text
classification} -> Text
classification) (\s :: PatchComplianceData
s@PatchComplianceData' {} Text
a -> PatchComplianceData
s {$sel:classification:PatchComplianceData' :: Text
classification = Text
a} :: PatchComplianceData)

-- | The severity of the patch such as @Critical@, @Important@, and
-- @Moderate@.
patchComplianceData_severity :: Lens.Lens' PatchComplianceData Prelude.Text
patchComplianceData_severity :: Lens' PatchComplianceData Text
patchComplianceData_severity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {Text
severity :: Text
$sel:severity:PatchComplianceData' :: PatchComplianceData -> Text
severity} -> Text
severity) (\s :: PatchComplianceData
s@PatchComplianceData' {} Text
a -> PatchComplianceData
s {$sel:severity:PatchComplianceData' :: Text
severity = Text
a} :: PatchComplianceData)

-- | The state of the patch on the managed node, such as INSTALLED or FAILED.
--
-- For descriptions of each patch state, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-compliance-about.html#sysman-compliance-monitor-patch About patch compliance>
-- in the /Amazon Web Services Systems Manager User Guide/.
patchComplianceData_state :: Lens.Lens' PatchComplianceData PatchComplianceDataState
patchComplianceData_state :: Lens' PatchComplianceData PatchComplianceDataState
patchComplianceData_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {PatchComplianceDataState
state :: PatchComplianceDataState
$sel:state:PatchComplianceData' :: PatchComplianceData -> PatchComplianceDataState
state} -> PatchComplianceDataState
state) (\s :: PatchComplianceData
s@PatchComplianceData' {} PatchComplianceDataState
a -> PatchComplianceData
s {$sel:state:PatchComplianceData' :: PatchComplianceDataState
state = PatchComplianceDataState
a} :: PatchComplianceData)

-- | The date\/time the patch was installed on the managed node. Not all
-- operating systems provide this level of information.
patchComplianceData_installedTime :: Lens.Lens' PatchComplianceData Prelude.UTCTime
patchComplianceData_installedTime :: Lens' PatchComplianceData UTCTime
patchComplianceData_installedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchComplianceData' {POSIX
installedTime :: POSIX
$sel:installedTime:PatchComplianceData' :: PatchComplianceData -> POSIX
installedTime} -> POSIX
installedTime) (\s :: PatchComplianceData
s@PatchComplianceData' {} POSIX
a -> PatchComplianceData
s {$sel:installedTime:PatchComplianceData' :: POSIX
installedTime = POSIX
a} :: PatchComplianceData) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON PatchComplianceData where
  parseJSON :: Value -> Parser PatchComplianceData
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PatchComplianceData"
      ( \Object
x ->
          Maybe Text
-> Text
-> Text
-> Text
-> Text
-> PatchComplianceDataState
-> POSIX
-> PatchComplianceData
PatchComplianceData'
            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
"CVEIds")
            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
"Title")
            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
"KBId")
            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
"Classification")
            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
"Severity")
            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
"State")
            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
"InstalledTime")
      )

instance Prelude.Hashable PatchComplianceData where
  hashWithSalt :: Int -> PatchComplianceData -> Int
hashWithSalt Int
_salt PatchComplianceData' {Maybe Text
Text
POSIX
PatchComplianceDataState
installedTime :: POSIX
state :: PatchComplianceDataState
severity :: Text
classification :: Text
kBId :: Text
title :: Text
cVEIds :: Maybe Text
$sel:installedTime:PatchComplianceData' :: PatchComplianceData -> POSIX
$sel:state:PatchComplianceData' :: PatchComplianceData -> PatchComplianceDataState
$sel:severity:PatchComplianceData' :: PatchComplianceData -> Text
$sel:classification:PatchComplianceData' :: PatchComplianceData -> Text
$sel:kBId:PatchComplianceData' :: PatchComplianceData -> Text
$sel:title:PatchComplianceData' :: PatchComplianceData -> Text
$sel:cVEIds:PatchComplianceData' :: PatchComplianceData -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cVEIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
kBId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
classification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
severity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PatchComplianceDataState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
installedTime

instance Prelude.NFData PatchComplianceData where
  rnf :: PatchComplianceData -> ()
rnf PatchComplianceData' {Maybe Text
Text
POSIX
PatchComplianceDataState
installedTime :: POSIX
state :: PatchComplianceDataState
severity :: Text
classification :: Text
kBId :: Text
title :: Text
cVEIds :: Maybe Text
$sel:installedTime:PatchComplianceData' :: PatchComplianceData -> POSIX
$sel:state:PatchComplianceData' :: PatchComplianceData -> PatchComplianceDataState
$sel:severity:PatchComplianceData' :: PatchComplianceData -> Text
$sel:classification:PatchComplianceData' :: PatchComplianceData -> Text
$sel:kBId:PatchComplianceData' :: PatchComplianceData -> Text
$sel:title:PatchComplianceData' :: PatchComplianceData -> Text
$sel:cVEIds:PatchComplianceData' :: PatchComplianceData -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cVEIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
kBId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
classification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
severity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PatchComplianceDataState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
installedTime