{-# 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.SecurityHub.Types.AwsSsmPatchComplianceDetails
-- 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.SecurityHub.Types.AwsSsmPatchComplianceDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsSsmPatch

-- | Provides information about the state of a patch on an instance based on
-- the patch baseline that was used to patch the instance.
--
-- /See:/ 'newAwsSsmPatchComplianceDetails' smart constructor.
data AwsSsmPatchComplianceDetails = AwsSsmPatchComplianceDetails'
  { -- | Information about the status of a patch.
    AwsSsmPatchComplianceDetails -> Maybe AwsSsmPatch
patch :: Prelude.Maybe AwsSsmPatch
  }
  deriving (AwsSsmPatchComplianceDetails
-> AwsSsmPatchComplianceDetails -> Bool
(AwsSsmPatchComplianceDetails
 -> AwsSsmPatchComplianceDetails -> Bool)
-> (AwsSsmPatchComplianceDetails
    -> AwsSsmPatchComplianceDetails -> Bool)
-> Eq AwsSsmPatchComplianceDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsSsmPatchComplianceDetails
-> AwsSsmPatchComplianceDetails -> Bool
$c/= :: AwsSsmPatchComplianceDetails
-> AwsSsmPatchComplianceDetails -> Bool
== :: AwsSsmPatchComplianceDetails
-> AwsSsmPatchComplianceDetails -> Bool
$c== :: AwsSsmPatchComplianceDetails
-> AwsSsmPatchComplianceDetails -> Bool
Prelude.Eq, ReadPrec [AwsSsmPatchComplianceDetails]
ReadPrec AwsSsmPatchComplianceDetails
Int -> ReadS AwsSsmPatchComplianceDetails
ReadS [AwsSsmPatchComplianceDetails]
(Int -> ReadS AwsSsmPatchComplianceDetails)
-> ReadS [AwsSsmPatchComplianceDetails]
-> ReadPrec AwsSsmPatchComplianceDetails
-> ReadPrec [AwsSsmPatchComplianceDetails]
-> Read AwsSsmPatchComplianceDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsSsmPatchComplianceDetails]
$creadListPrec :: ReadPrec [AwsSsmPatchComplianceDetails]
readPrec :: ReadPrec AwsSsmPatchComplianceDetails
$creadPrec :: ReadPrec AwsSsmPatchComplianceDetails
readList :: ReadS [AwsSsmPatchComplianceDetails]
$creadList :: ReadS [AwsSsmPatchComplianceDetails]
readsPrec :: Int -> ReadS AwsSsmPatchComplianceDetails
$creadsPrec :: Int -> ReadS AwsSsmPatchComplianceDetails
Prelude.Read, Int -> AwsSsmPatchComplianceDetails -> ShowS
[AwsSsmPatchComplianceDetails] -> ShowS
AwsSsmPatchComplianceDetails -> String
(Int -> AwsSsmPatchComplianceDetails -> ShowS)
-> (AwsSsmPatchComplianceDetails -> String)
-> ([AwsSsmPatchComplianceDetails] -> ShowS)
-> Show AwsSsmPatchComplianceDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsSsmPatchComplianceDetails] -> ShowS
$cshowList :: [AwsSsmPatchComplianceDetails] -> ShowS
show :: AwsSsmPatchComplianceDetails -> String
$cshow :: AwsSsmPatchComplianceDetails -> String
showsPrec :: Int -> AwsSsmPatchComplianceDetails -> ShowS
$cshowsPrec :: Int -> AwsSsmPatchComplianceDetails -> ShowS
Prelude.Show, (forall x.
 AwsSsmPatchComplianceDetails -> Rep AwsSsmPatchComplianceDetails x)
-> (forall x.
    Rep AwsSsmPatchComplianceDetails x -> AwsSsmPatchComplianceDetails)
-> Generic AwsSsmPatchComplianceDetails
forall x.
Rep AwsSsmPatchComplianceDetails x -> AwsSsmPatchComplianceDetails
forall x.
AwsSsmPatchComplianceDetails -> Rep AwsSsmPatchComplianceDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsSsmPatchComplianceDetails x -> AwsSsmPatchComplianceDetails
$cfrom :: forall x.
AwsSsmPatchComplianceDetails -> Rep AwsSsmPatchComplianceDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsSsmPatchComplianceDetails' 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:
--
-- 'patch', 'awsSsmPatchComplianceDetails_patch' - Information about the status of a patch.
newAwsSsmPatchComplianceDetails ::
  AwsSsmPatchComplianceDetails
newAwsSsmPatchComplianceDetails :: AwsSsmPatchComplianceDetails
newAwsSsmPatchComplianceDetails =
  AwsSsmPatchComplianceDetails' :: Maybe AwsSsmPatch -> AwsSsmPatchComplianceDetails
AwsSsmPatchComplianceDetails'
    { $sel:patch:AwsSsmPatchComplianceDetails' :: Maybe AwsSsmPatch
patch =
        Maybe AwsSsmPatch
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the status of a patch.
awsSsmPatchComplianceDetails_patch :: Lens.Lens' AwsSsmPatchComplianceDetails (Prelude.Maybe AwsSsmPatch)
awsSsmPatchComplianceDetails_patch :: (Maybe AwsSsmPatch -> f (Maybe AwsSsmPatch))
-> AwsSsmPatchComplianceDetails -> f AwsSsmPatchComplianceDetails
awsSsmPatchComplianceDetails_patch = (AwsSsmPatchComplianceDetails -> Maybe AwsSsmPatch)
-> (AwsSsmPatchComplianceDetails
    -> Maybe AwsSsmPatch -> AwsSsmPatchComplianceDetails)
-> Lens
     AwsSsmPatchComplianceDetails
     AwsSsmPatchComplianceDetails
     (Maybe AwsSsmPatch)
     (Maybe AwsSsmPatch)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsSsmPatchComplianceDetails' {Maybe AwsSsmPatch
patch :: Maybe AwsSsmPatch
$sel:patch:AwsSsmPatchComplianceDetails' :: AwsSsmPatchComplianceDetails -> Maybe AwsSsmPatch
patch} -> Maybe AwsSsmPatch
patch) (\s :: AwsSsmPatchComplianceDetails
s@AwsSsmPatchComplianceDetails' {} Maybe AwsSsmPatch
a -> AwsSsmPatchComplianceDetails
s {$sel:patch:AwsSsmPatchComplianceDetails' :: Maybe AwsSsmPatch
patch = Maybe AwsSsmPatch
a} :: AwsSsmPatchComplianceDetails)

instance Core.FromJSON AwsSsmPatchComplianceDetails where
  parseJSON :: Value -> Parser AwsSsmPatchComplianceDetails
parseJSON =
    String
-> (Object -> Parser AwsSsmPatchComplianceDetails)
-> Value
-> Parser AwsSsmPatchComplianceDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsSsmPatchComplianceDetails"
      ( \Object
x ->
          Maybe AwsSsmPatch -> AwsSsmPatchComplianceDetails
AwsSsmPatchComplianceDetails'
            (Maybe AwsSsmPatch -> AwsSsmPatchComplianceDetails)
-> Parser (Maybe AwsSsmPatch)
-> Parser AwsSsmPatchComplianceDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AwsSsmPatch)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Patch")
      )

instance
  Prelude.Hashable
    AwsSsmPatchComplianceDetails

instance Prelude.NFData AwsSsmPatchComplianceDetails

instance Core.ToJSON AwsSsmPatchComplianceDetails where
  toJSON :: AwsSsmPatchComplianceDetails -> Value
toJSON AwsSsmPatchComplianceDetails' {Maybe AwsSsmPatch
patch :: Maybe AwsSsmPatch
$sel:patch:AwsSsmPatchComplianceDetails' :: AwsSsmPatchComplianceDetails -> Maybe AwsSsmPatch
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Patch" Text -> AwsSsmPatch -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsSsmPatch -> Pair) -> Maybe AwsSsmPatch -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsSsmPatch
patch]
      )