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

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

-- | Provides details about the compliance for a patch.
--
-- /See:/ 'newAwsSsmPatch' smart constructor.
data AwsSsmPatch = AwsSsmPatch'
  { -- | The compliance status details for the patch.
    AwsSsmPatch -> Maybe AwsSsmComplianceSummary
complianceSummary :: Prelude.Maybe AwsSsmComplianceSummary
  }
  deriving (AwsSsmPatch -> AwsSsmPatch -> Bool
(AwsSsmPatch -> AwsSsmPatch -> Bool)
-> (AwsSsmPatch -> AwsSsmPatch -> Bool) -> Eq AwsSsmPatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsSsmPatch -> AwsSsmPatch -> Bool
$c/= :: AwsSsmPatch -> AwsSsmPatch -> Bool
== :: AwsSsmPatch -> AwsSsmPatch -> Bool
$c== :: AwsSsmPatch -> AwsSsmPatch -> Bool
Prelude.Eq, ReadPrec [AwsSsmPatch]
ReadPrec AwsSsmPatch
Int -> ReadS AwsSsmPatch
ReadS [AwsSsmPatch]
(Int -> ReadS AwsSsmPatch)
-> ReadS [AwsSsmPatch]
-> ReadPrec AwsSsmPatch
-> ReadPrec [AwsSsmPatch]
-> Read AwsSsmPatch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsSsmPatch]
$creadListPrec :: ReadPrec [AwsSsmPatch]
readPrec :: ReadPrec AwsSsmPatch
$creadPrec :: ReadPrec AwsSsmPatch
readList :: ReadS [AwsSsmPatch]
$creadList :: ReadS [AwsSsmPatch]
readsPrec :: Int -> ReadS AwsSsmPatch
$creadsPrec :: Int -> ReadS AwsSsmPatch
Prelude.Read, Int -> AwsSsmPatch -> ShowS
[AwsSsmPatch] -> ShowS
AwsSsmPatch -> String
(Int -> AwsSsmPatch -> ShowS)
-> (AwsSsmPatch -> String)
-> ([AwsSsmPatch] -> ShowS)
-> Show AwsSsmPatch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsSsmPatch] -> ShowS
$cshowList :: [AwsSsmPatch] -> ShowS
show :: AwsSsmPatch -> String
$cshow :: AwsSsmPatch -> String
showsPrec :: Int -> AwsSsmPatch -> ShowS
$cshowsPrec :: Int -> AwsSsmPatch -> ShowS
Prelude.Show, (forall x. AwsSsmPatch -> Rep AwsSsmPatch x)
-> (forall x. Rep AwsSsmPatch x -> AwsSsmPatch)
-> Generic AwsSsmPatch
forall x. Rep AwsSsmPatch x -> AwsSsmPatch
forall x. AwsSsmPatch -> Rep AwsSsmPatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsSsmPatch x -> AwsSsmPatch
$cfrom :: forall x. AwsSsmPatch -> Rep AwsSsmPatch x
Prelude.Generic)

-- |
-- Create a value of 'AwsSsmPatch' 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:
--
-- 'complianceSummary', 'awsSsmPatch_complianceSummary' - The compliance status details for the patch.
newAwsSsmPatch ::
  AwsSsmPatch
newAwsSsmPatch :: AwsSsmPatch
newAwsSsmPatch =
  AwsSsmPatch' :: Maybe AwsSsmComplianceSummary -> AwsSsmPatch
AwsSsmPatch' {$sel:complianceSummary:AwsSsmPatch' :: Maybe AwsSsmComplianceSummary
complianceSummary = Maybe AwsSsmComplianceSummary
forall a. Maybe a
Prelude.Nothing}

-- | The compliance status details for the patch.
awsSsmPatch_complianceSummary :: Lens.Lens' AwsSsmPatch (Prelude.Maybe AwsSsmComplianceSummary)
awsSsmPatch_complianceSummary :: (Maybe AwsSsmComplianceSummary
 -> f (Maybe AwsSsmComplianceSummary))
-> AwsSsmPatch -> f AwsSsmPatch
awsSsmPatch_complianceSummary = (AwsSsmPatch -> Maybe AwsSsmComplianceSummary)
-> (AwsSsmPatch -> Maybe AwsSsmComplianceSummary -> AwsSsmPatch)
-> Lens
     AwsSsmPatch
     AwsSsmPatch
     (Maybe AwsSsmComplianceSummary)
     (Maybe AwsSsmComplianceSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsSsmPatch' {Maybe AwsSsmComplianceSummary
complianceSummary :: Maybe AwsSsmComplianceSummary
$sel:complianceSummary:AwsSsmPatch' :: AwsSsmPatch -> Maybe AwsSsmComplianceSummary
complianceSummary} -> Maybe AwsSsmComplianceSummary
complianceSummary) (\s :: AwsSsmPatch
s@AwsSsmPatch' {} Maybe AwsSsmComplianceSummary
a -> AwsSsmPatch
s {$sel:complianceSummary:AwsSsmPatch' :: Maybe AwsSsmComplianceSummary
complianceSummary = Maybe AwsSsmComplianceSummary
a} :: AwsSsmPatch)

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

instance Prelude.Hashable AwsSsmPatch

instance Prelude.NFData AwsSsmPatch

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