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

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

-- | Information about the state of a patch on a particular instance as it
-- relates to the patch baseline used to patch the instance.
--
-- /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 patchsuch as @Critical@, @Important@, and
    -- @Moderate@.
    PatchComplianceData -> Text
severity :: Prelude.Text,
    -- | The state of the patch on the instance, 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 instance. Not all
    -- operating systems provide this level of information.
    PatchComplianceData -> POSIX
installedTime :: Core.POSIX
  }
  deriving (PatchComplianceData -> PatchComplianceData -> Bool
(PatchComplianceData -> PatchComplianceData -> Bool)
-> (PatchComplianceData -> PatchComplianceData -> Bool)
-> Eq PatchComplianceData
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]
(Int -> ReadS PatchComplianceData)
-> ReadS [PatchComplianceData]
-> ReadPrec PatchComplianceData
-> ReadPrec [PatchComplianceData]
-> Read 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
(Int -> PatchComplianceData -> ShowS)
-> (PatchComplianceData -> String)
-> ([PatchComplianceData] -> ShowS)
-> Show PatchComplianceData
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. PatchComplianceData -> Rep PatchComplianceData x)
-> (forall x. Rep PatchComplianceData x -> PatchComplianceData)
-> Generic PatchComplianceData
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 patchsuch as @Critical@, @Important@, and
-- @Moderate@.
--
-- 'state', 'patchComplianceData_state' - The state of the patch on the instance, 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 instance. 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' :: Maybe Text
-> Text
-> Text
-> Text
-> Text
-> PatchComplianceDataState
-> POSIX
-> PatchComplianceData
PatchComplianceData'
      { $sel:cVEIds:PatchComplianceData' :: Maybe Text
cVEIds = Maybe Text
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 = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
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 :: (Maybe Text -> f (Maybe Text))
-> PatchComplianceData -> f PatchComplianceData
patchComplianceData_cVEIds = (PatchComplianceData -> Maybe Text)
-> (PatchComplianceData -> Maybe Text -> PatchComplianceData)
-> Lens
     PatchComplianceData PatchComplianceData (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> PatchComplianceData -> f PatchComplianceData
patchComplianceData_title = (PatchComplianceData -> Text)
-> (PatchComplianceData -> Text -> PatchComplianceData)
-> Lens PatchComplianceData PatchComplianceData Text Text
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 :: (Text -> f Text) -> PatchComplianceData -> f PatchComplianceData
patchComplianceData_kBId = (PatchComplianceData -> Text)
-> (PatchComplianceData -> Text -> PatchComplianceData)
-> Lens PatchComplianceData PatchComplianceData Text Text
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 :: (Text -> f Text) -> PatchComplianceData -> f PatchComplianceData
patchComplianceData_classification = (PatchComplianceData -> Text)
-> (PatchComplianceData -> Text -> PatchComplianceData)
-> Lens PatchComplianceData PatchComplianceData Text Text
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 patchsuch as @Critical@, @Important@, and
-- @Moderate@.
patchComplianceData_severity :: Lens.Lens' PatchComplianceData Prelude.Text
patchComplianceData_severity :: (Text -> f Text) -> PatchComplianceData -> f PatchComplianceData
patchComplianceData_severity = (PatchComplianceData -> Text)
-> (PatchComplianceData -> Text -> PatchComplianceData)
-> Lens PatchComplianceData PatchComplianceData Text Text
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 instance, 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 :: (PatchComplianceDataState -> f PatchComplianceDataState)
-> PatchComplianceData -> f PatchComplianceData
patchComplianceData_state = (PatchComplianceData -> PatchComplianceDataState)
-> (PatchComplianceData
    -> PatchComplianceDataState -> PatchComplianceData)
-> Lens
     PatchComplianceData
     PatchComplianceData
     PatchComplianceDataState
     PatchComplianceDataState
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 instance. Not all
-- operating systems provide this level of information.
patchComplianceData_installedTime :: Lens.Lens' PatchComplianceData Prelude.UTCTime
patchComplianceData_installedTime :: (UTCTime -> f UTCTime)
-> PatchComplianceData -> f PatchComplianceData
patchComplianceData_installedTime = (PatchComplianceData -> POSIX)
-> (PatchComplianceData -> POSIX -> PatchComplianceData)
-> Lens PatchComplianceData PatchComplianceData POSIX POSIX
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) ((POSIX -> f POSIX)
 -> PatchComplianceData -> f PatchComplianceData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PatchComplianceData
-> f PatchComplianceData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.Hashable PatchComplianceData

instance Prelude.NFData PatchComplianceData