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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.ComplianceSeverity
import Amazonka.SSM.Types.ComplianceStatus

-- | Information about a compliance item.
--
-- /See:/ 'newComplianceItemEntry' smart constructor.
data ComplianceItemEntry = ComplianceItemEntry'
  { -- | A \"Key\": \"Value\" tag combination for the compliance item.
    ComplianceItemEntry -> Maybe (HashMap Text Text)
details :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The compliance item ID. For example, if the compliance item is a Windows
    -- patch, the ID could be the number of the KB article.
    ComplianceItemEntry -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The title of the compliance item. For example, if the compliance item is
    -- a Windows patch, the title could be the title of the KB article for the
    -- patch; for example: Security Update for Active Directory Federation
    -- Services.
    ComplianceItemEntry -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | The severity of the compliance status. Severity can be one of the
    -- following: Critical, High, Medium, Low, Informational, Unspecified.
    ComplianceItemEntry -> ComplianceSeverity
severity :: ComplianceSeverity,
    -- | The status of the compliance item. An item is either COMPLIANT or
    -- NON_COMPLIANT.
    ComplianceItemEntry -> ComplianceStatus
status :: ComplianceStatus
  }
  deriving (ComplianceItemEntry -> ComplianceItemEntry -> Bool
(ComplianceItemEntry -> ComplianceItemEntry -> Bool)
-> (ComplianceItemEntry -> ComplianceItemEntry -> Bool)
-> Eq ComplianceItemEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceItemEntry -> ComplianceItemEntry -> Bool
$c/= :: ComplianceItemEntry -> ComplianceItemEntry -> Bool
== :: ComplianceItemEntry -> ComplianceItemEntry -> Bool
$c== :: ComplianceItemEntry -> ComplianceItemEntry -> Bool
Prelude.Eq, ReadPrec [ComplianceItemEntry]
ReadPrec ComplianceItemEntry
Int -> ReadS ComplianceItemEntry
ReadS [ComplianceItemEntry]
(Int -> ReadS ComplianceItemEntry)
-> ReadS [ComplianceItemEntry]
-> ReadPrec ComplianceItemEntry
-> ReadPrec [ComplianceItemEntry]
-> Read ComplianceItemEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceItemEntry]
$creadListPrec :: ReadPrec [ComplianceItemEntry]
readPrec :: ReadPrec ComplianceItemEntry
$creadPrec :: ReadPrec ComplianceItemEntry
readList :: ReadS [ComplianceItemEntry]
$creadList :: ReadS [ComplianceItemEntry]
readsPrec :: Int -> ReadS ComplianceItemEntry
$creadsPrec :: Int -> ReadS ComplianceItemEntry
Prelude.Read, Int -> ComplianceItemEntry -> ShowS
[ComplianceItemEntry] -> ShowS
ComplianceItemEntry -> String
(Int -> ComplianceItemEntry -> ShowS)
-> (ComplianceItemEntry -> String)
-> ([ComplianceItemEntry] -> ShowS)
-> Show ComplianceItemEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceItemEntry] -> ShowS
$cshowList :: [ComplianceItemEntry] -> ShowS
show :: ComplianceItemEntry -> String
$cshow :: ComplianceItemEntry -> String
showsPrec :: Int -> ComplianceItemEntry -> ShowS
$cshowsPrec :: Int -> ComplianceItemEntry -> ShowS
Prelude.Show, (forall x. ComplianceItemEntry -> Rep ComplianceItemEntry x)
-> (forall x. Rep ComplianceItemEntry x -> ComplianceItemEntry)
-> Generic ComplianceItemEntry
forall x. Rep ComplianceItemEntry x -> ComplianceItemEntry
forall x. ComplianceItemEntry -> Rep ComplianceItemEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComplianceItemEntry x -> ComplianceItemEntry
$cfrom :: forall x. ComplianceItemEntry -> Rep ComplianceItemEntry x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceItemEntry' 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:
--
-- 'details', 'complianceItemEntry_details' - A \"Key\": \"Value\" tag combination for the compliance item.
--
-- 'id', 'complianceItemEntry_id' - The compliance item ID. For example, if the compliance item is a Windows
-- patch, the ID could be the number of the KB article.
--
-- 'title', 'complianceItemEntry_title' - The title of the compliance item. For example, if the compliance item is
-- a Windows patch, the title could be the title of the KB article for the
-- patch; for example: Security Update for Active Directory Federation
-- Services.
--
-- 'severity', 'complianceItemEntry_severity' - The severity of the compliance status. Severity can be one of the
-- following: Critical, High, Medium, Low, Informational, Unspecified.
--
-- 'status', 'complianceItemEntry_status' - The status of the compliance item. An item is either COMPLIANT or
-- NON_COMPLIANT.
newComplianceItemEntry ::
  -- | 'severity'
  ComplianceSeverity ->
  -- | 'status'
  ComplianceStatus ->
  ComplianceItemEntry
newComplianceItemEntry :: ComplianceSeverity -> ComplianceStatus -> ComplianceItemEntry
newComplianceItemEntry ComplianceSeverity
pSeverity_ ComplianceStatus
pStatus_ =
  ComplianceItemEntry' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> ComplianceSeverity
-> ComplianceStatus
-> ComplianceItemEntry
ComplianceItemEntry'
    { $sel:details:ComplianceItemEntry' :: Maybe (HashMap Text Text)
details = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ComplianceItemEntry' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:title:ComplianceItemEntry' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:severity:ComplianceItemEntry' :: ComplianceSeverity
severity = ComplianceSeverity
pSeverity_,
      $sel:status:ComplianceItemEntry' :: ComplianceStatus
status = ComplianceStatus
pStatus_
    }

-- | A \"Key\": \"Value\" tag combination for the compliance item.
complianceItemEntry_details :: Lens.Lens' ComplianceItemEntry (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
complianceItemEntry_details :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ComplianceItemEntry -> f ComplianceItemEntry
complianceItemEntry_details = (ComplianceItemEntry -> Maybe (HashMap Text Text))
-> (ComplianceItemEntry
    -> Maybe (HashMap Text Text) -> ComplianceItemEntry)
-> Lens
     ComplianceItemEntry
     ComplianceItemEntry
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceItemEntry' {Maybe (HashMap Text Text)
details :: Maybe (HashMap Text Text)
$sel:details:ComplianceItemEntry' :: ComplianceItemEntry -> Maybe (HashMap Text Text)
details} -> Maybe (HashMap Text Text)
details) (\s :: ComplianceItemEntry
s@ComplianceItemEntry' {} Maybe (HashMap Text Text)
a -> ComplianceItemEntry
s {$sel:details:ComplianceItemEntry' :: Maybe (HashMap Text Text)
details = Maybe (HashMap Text Text)
a} :: ComplianceItemEntry) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ComplianceItemEntry -> f ComplianceItemEntry)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ComplianceItemEntry
-> f ComplianceItemEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The compliance item ID. For example, if the compliance item is a Windows
-- patch, the ID could be the number of the KB article.
complianceItemEntry_id :: Lens.Lens' ComplianceItemEntry (Prelude.Maybe Prelude.Text)
complianceItemEntry_id :: (Maybe Text -> f (Maybe Text))
-> ComplianceItemEntry -> f ComplianceItemEntry
complianceItemEntry_id = (ComplianceItemEntry -> Maybe Text)
-> (ComplianceItemEntry -> Maybe Text -> ComplianceItemEntry)
-> Lens
     ComplianceItemEntry ComplianceItemEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceItemEntry' {Maybe Text
id :: Maybe Text
$sel:id:ComplianceItemEntry' :: ComplianceItemEntry -> Maybe Text
id} -> Maybe Text
id) (\s :: ComplianceItemEntry
s@ComplianceItemEntry' {} Maybe Text
a -> ComplianceItemEntry
s {$sel:id:ComplianceItemEntry' :: Maybe Text
id = Maybe Text
a} :: ComplianceItemEntry)

-- | The title of the compliance item. For example, if the compliance item is
-- a Windows patch, the title could be the title of the KB article for the
-- patch; for example: Security Update for Active Directory Federation
-- Services.
complianceItemEntry_title :: Lens.Lens' ComplianceItemEntry (Prelude.Maybe Prelude.Text)
complianceItemEntry_title :: (Maybe Text -> f (Maybe Text))
-> ComplianceItemEntry -> f ComplianceItemEntry
complianceItemEntry_title = (ComplianceItemEntry -> Maybe Text)
-> (ComplianceItemEntry -> Maybe Text -> ComplianceItemEntry)
-> Lens
     ComplianceItemEntry ComplianceItemEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceItemEntry' {Maybe Text
title :: Maybe Text
$sel:title:ComplianceItemEntry' :: ComplianceItemEntry -> Maybe Text
title} -> Maybe Text
title) (\s :: ComplianceItemEntry
s@ComplianceItemEntry' {} Maybe Text
a -> ComplianceItemEntry
s {$sel:title:ComplianceItemEntry' :: Maybe Text
title = Maybe Text
a} :: ComplianceItemEntry)

-- | The severity of the compliance status. Severity can be one of the
-- following: Critical, High, Medium, Low, Informational, Unspecified.
complianceItemEntry_severity :: Lens.Lens' ComplianceItemEntry ComplianceSeverity
complianceItemEntry_severity :: (ComplianceSeverity -> f ComplianceSeverity)
-> ComplianceItemEntry -> f ComplianceItemEntry
complianceItemEntry_severity = (ComplianceItemEntry -> ComplianceSeverity)
-> (ComplianceItemEntry
    -> ComplianceSeverity -> ComplianceItemEntry)
-> Lens
     ComplianceItemEntry
     ComplianceItemEntry
     ComplianceSeverity
     ComplianceSeverity
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceItemEntry' {ComplianceSeverity
severity :: ComplianceSeverity
$sel:severity:ComplianceItemEntry' :: ComplianceItemEntry -> ComplianceSeverity
severity} -> ComplianceSeverity
severity) (\s :: ComplianceItemEntry
s@ComplianceItemEntry' {} ComplianceSeverity
a -> ComplianceItemEntry
s {$sel:severity:ComplianceItemEntry' :: ComplianceSeverity
severity = ComplianceSeverity
a} :: ComplianceItemEntry)

-- | The status of the compliance item. An item is either COMPLIANT or
-- NON_COMPLIANT.
complianceItemEntry_status :: Lens.Lens' ComplianceItemEntry ComplianceStatus
complianceItemEntry_status :: (ComplianceStatus -> f ComplianceStatus)
-> ComplianceItemEntry -> f ComplianceItemEntry
complianceItemEntry_status = (ComplianceItemEntry -> ComplianceStatus)
-> (ComplianceItemEntry -> ComplianceStatus -> ComplianceItemEntry)
-> Lens
     ComplianceItemEntry
     ComplianceItemEntry
     ComplianceStatus
     ComplianceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceItemEntry' {ComplianceStatus
status :: ComplianceStatus
$sel:status:ComplianceItemEntry' :: ComplianceItemEntry -> ComplianceStatus
status} -> ComplianceStatus
status) (\s :: ComplianceItemEntry
s@ComplianceItemEntry' {} ComplianceStatus
a -> ComplianceItemEntry
s {$sel:status:ComplianceItemEntry' :: ComplianceStatus
status = ComplianceStatus
a} :: ComplianceItemEntry)

instance Prelude.Hashable ComplianceItemEntry

instance Prelude.NFData ComplianceItemEntry

instance Core.ToJSON ComplianceItemEntry where
  toJSON :: ComplianceItemEntry -> Value
toJSON ComplianceItemEntry' {Maybe Text
Maybe (HashMap Text Text)
ComplianceSeverity
ComplianceStatus
status :: ComplianceStatus
severity :: ComplianceSeverity
title :: Maybe Text
id :: Maybe Text
details :: Maybe (HashMap Text Text)
$sel:status:ComplianceItemEntry' :: ComplianceItemEntry -> ComplianceStatus
$sel:severity:ComplianceItemEntry' :: ComplianceItemEntry -> ComplianceSeverity
$sel:title:ComplianceItemEntry' :: ComplianceItemEntry -> Maybe Text
$sel:id:ComplianceItemEntry' :: ComplianceItemEntry -> Maybe Text
$sel:details:ComplianceItemEntry' :: ComplianceItemEntry -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Details" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
details,
            (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id,
            (Text
"Title" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
title,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Severity" Text -> ComplianceSeverity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComplianceSeverity
severity),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Status" Text -> ComplianceStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComplianceStatus
status)
          ]
      )