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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.PatchComplianceLevel
import Amazonka.SSM.Types.PatchDeploymentStatus

-- | Information about the approval status of a patch.
--
-- /See:/ 'newPatchStatus' smart constructor.
data PatchStatus = PatchStatus'
  { -- | The date the patch was approved (or will be approved if the status is
    -- @PENDING_APPROVAL@).
    PatchStatus -> Maybe POSIX
approvalDate :: Prelude.Maybe Core.POSIX,
    -- | The approval status of a patch.
    PatchStatus -> Maybe PatchDeploymentStatus
deploymentStatus :: Prelude.Maybe PatchDeploymentStatus,
    -- | The compliance severity level for a patch.
    PatchStatus -> Maybe PatchComplianceLevel
complianceLevel :: Prelude.Maybe PatchComplianceLevel
  }
  deriving (PatchStatus -> PatchStatus -> Bool
(PatchStatus -> PatchStatus -> Bool)
-> (PatchStatus -> PatchStatus -> Bool) -> Eq PatchStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchStatus -> PatchStatus -> Bool
$c/= :: PatchStatus -> PatchStatus -> Bool
== :: PatchStatus -> PatchStatus -> Bool
$c== :: PatchStatus -> PatchStatus -> Bool
Prelude.Eq, ReadPrec [PatchStatus]
ReadPrec PatchStatus
Int -> ReadS PatchStatus
ReadS [PatchStatus]
(Int -> ReadS PatchStatus)
-> ReadS [PatchStatus]
-> ReadPrec PatchStatus
-> ReadPrec [PatchStatus]
-> Read PatchStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchStatus]
$creadListPrec :: ReadPrec [PatchStatus]
readPrec :: ReadPrec PatchStatus
$creadPrec :: ReadPrec PatchStatus
readList :: ReadS [PatchStatus]
$creadList :: ReadS [PatchStatus]
readsPrec :: Int -> ReadS PatchStatus
$creadsPrec :: Int -> ReadS PatchStatus
Prelude.Read, Int -> PatchStatus -> ShowS
[PatchStatus] -> ShowS
PatchStatus -> String
(Int -> PatchStatus -> ShowS)
-> (PatchStatus -> String)
-> ([PatchStatus] -> ShowS)
-> Show PatchStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchStatus] -> ShowS
$cshowList :: [PatchStatus] -> ShowS
show :: PatchStatus -> String
$cshow :: PatchStatus -> String
showsPrec :: Int -> PatchStatus -> ShowS
$cshowsPrec :: Int -> PatchStatus -> ShowS
Prelude.Show, (forall x. PatchStatus -> Rep PatchStatus x)
-> (forall x. Rep PatchStatus x -> PatchStatus)
-> Generic PatchStatus
forall x. Rep PatchStatus x -> PatchStatus
forall x. PatchStatus -> Rep PatchStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchStatus x -> PatchStatus
$cfrom :: forall x. PatchStatus -> Rep PatchStatus x
Prelude.Generic)

-- |
-- Create a value of 'PatchStatus' 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:
--
-- 'approvalDate', 'patchStatus_approvalDate' - The date the patch was approved (or will be approved if the status is
-- @PENDING_APPROVAL@).
--
-- 'deploymentStatus', 'patchStatus_deploymentStatus' - The approval status of a patch.
--
-- 'complianceLevel', 'patchStatus_complianceLevel' - The compliance severity level for a patch.
newPatchStatus ::
  PatchStatus
newPatchStatus :: PatchStatus
newPatchStatus =
  PatchStatus' :: Maybe POSIX
-> Maybe PatchDeploymentStatus
-> Maybe PatchComplianceLevel
-> PatchStatus
PatchStatus'
    { $sel:approvalDate:PatchStatus' :: Maybe POSIX
approvalDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatus:PatchStatus' :: Maybe PatchDeploymentStatus
deploymentStatus = Maybe PatchDeploymentStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceLevel:PatchStatus' :: Maybe PatchComplianceLevel
complianceLevel = Maybe PatchComplianceLevel
forall a. Maybe a
Prelude.Nothing
    }

-- | The date the patch was approved (or will be approved if the status is
-- @PENDING_APPROVAL@).
patchStatus_approvalDate :: Lens.Lens' PatchStatus (Prelude.Maybe Prelude.UTCTime)
patchStatus_approvalDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PatchStatus -> f PatchStatus
patchStatus_approvalDate = (PatchStatus -> Maybe POSIX)
-> (PatchStatus -> Maybe POSIX -> PatchStatus)
-> Lens PatchStatus PatchStatus (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchStatus' {Maybe POSIX
approvalDate :: Maybe POSIX
$sel:approvalDate:PatchStatus' :: PatchStatus -> Maybe POSIX
approvalDate} -> Maybe POSIX
approvalDate) (\s :: PatchStatus
s@PatchStatus' {} Maybe POSIX
a -> PatchStatus
s {$sel:approvalDate:PatchStatus' :: Maybe POSIX
approvalDate = Maybe POSIX
a} :: PatchStatus) ((Maybe POSIX -> f (Maybe POSIX)) -> PatchStatus -> f PatchStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PatchStatus
-> f PatchStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The approval status of a patch.
patchStatus_deploymentStatus :: Lens.Lens' PatchStatus (Prelude.Maybe PatchDeploymentStatus)
patchStatus_deploymentStatus :: (Maybe PatchDeploymentStatus -> f (Maybe PatchDeploymentStatus))
-> PatchStatus -> f PatchStatus
patchStatus_deploymentStatus = (PatchStatus -> Maybe PatchDeploymentStatus)
-> (PatchStatus -> Maybe PatchDeploymentStatus -> PatchStatus)
-> Lens
     PatchStatus
     PatchStatus
     (Maybe PatchDeploymentStatus)
     (Maybe PatchDeploymentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchStatus' {Maybe PatchDeploymentStatus
deploymentStatus :: Maybe PatchDeploymentStatus
$sel:deploymentStatus:PatchStatus' :: PatchStatus -> Maybe PatchDeploymentStatus
deploymentStatus} -> Maybe PatchDeploymentStatus
deploymentStatus) (\s :: PatchStatus
s@PatchStatus' {} Maybe PatchDeploymentStatus
a -> PatchStatus
s {$sel:deploymentStatus:PatchStatus' :: Maybe PatchDeploymentStatus
deploymentStatus = Maybe PatchDeploymentStatus
a} :: PatchStatus)

-- | The compliance severity level for a patch.
patchStatus_complianceLevel :: Lens.Lens' PatchStatus (Prelude.Maybe PatchComplianceLevel)
patchStatus_complianceLevel :: (Maybe PatchComplianceLevel -> f (Maybe PatchComplianceLevel))
-> PatchStatus -> f PatchStatus
patchStatus_complianceLevel = (PatchStatus -> Maybe PatchComplianceLevel)
-> (PatchStatus -> Maybe PatchComplianceLevel -> PatchStatus)
-> Lens
     PatchStatus
     PatchStatus
     (Maybe PatchComplianceLevel)
     (Maybe PatchComplianceLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchStatus' {Maybe PatchComplianceLevel
complianceLevel :: Maybe PatchComplianceLevel
$sel:complianceLevel:PatchStatus' :: PatchStatus -> Maybe PatchComplianceLevel
complianceLevel} -> Maybe PatchComplianceLevel
complianceLevel) (\s :: PatchStatus
s@PatchStatus' {} Maybe PatchComplianceLevel
a -> PatchStatus
s {$sel:complianceLevel:PatchStatus' :: Maybe PatchComplianceLevel
complianceLevel = Maybe PatchComplianceLevel
a} :: PatchStatus)

instance Core.FromJSON PatchStatus where
  parseJSON :: Value -> Parser PatchStatus
parseJSON =
    String
-> (Object -> Parser PatchStatus) -> Value -> Parser PatchStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PatchStatus"
      ( \Object
x ->
          Maybe POSIX
-> Maybe PatchDeploymentStatus
-> Maybe PatchComplianceLevel
-> PatchStatus
PatchStatus'
            (Maybe POSIX
 -> Maybe PatchDeploymentStatus
 -> Maybe PatchComplianceLevel
 -> PatchStatus)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe PatchDeploymentStatus
      -> Maybe PatchComplianceLevel -> PatchStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApprovalDate")
            Parser
  (Maybe PatchDeploymentStatus
   -> Maybe PatchComplianceLevel -> PatchStatus)
-> Parser (Maybe PatchDeploymentStatus)
-> Parser (Maybe PatchComplianceLevel -> PatchStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PatchDeploymentStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeploymentStatus")
            Parser (Maybe PatchComplianceLevel -> PatchStatus)
-> Parser (Maybe PatchComplianceLevel) -> Parser PatchStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PatchComplianceLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceLevel")
      )

instance Prelude.Hashable PatchStatus

instance Prelude.NFData PatchStatus