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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.CompliantSummary
import Amazonka.SSM.Types.NonCompliantSummary

-- | A summary of compliance information by compliance type.
--
-- /See:/ 'newComplianceSummaryItem' smart constructor.
data ComplianceSummaryItem = ComplianceSummaryItem'
  { -- | A list of NON_COMPLIANT items for the specified compliance type.
    ComplianceSummaryItem -> Maybe NonCompliantSummary
nonCompliantSummary :: Prelude.Maybe NonCompliantSummary,
    -- | A list of COMPLIANT items for the specified compliance type.
    ComplianceSummaryItem -> Maybe CompliantSummary
compliantSummary :: Prelude.Maybe CompliantSummary,
    -- | The type of compliance item. For example, the compliance type can be
    -- Association, Patch, or Custom:string.
    ComplianceSummaryItem -> Maybe Text
complianceType :: Prelude.Maybe Prelude.Text
  }
  deriving (ComplianceSummaryItem -> ComplianceSummaryItem -> Bool
(ComplianceSummaryItem -> ComplianceSummaryItem -> Bool)
-> (ComplianceSummaryItem -> ComplianceSummaryItem -> Bool)
-> Eq ComplianceSummaryItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceSummaryItem -> ComplianceSummaryItem -> Bool
$c/= :: ComplianceSummaryItem -> ComplianceSummaryItem -> Bool
== :: ComplianceSummaryItem -> ComplianceSummaryItem -> Bool
$c== :: ComplianceSummaryItem -> ComplianceSummaryItem -> Bool
Prelude.Eq, ReadPrec [ComplianceSummaryItem]
ReadPrec ComplianceSummaryItem
Int -> ReadS ComplianceSummaryItem
ReadS [ComplianceSummaryItem]
(Int -> ReadS ComplianceSummaryItem)
-> ReadS [ComplianceSummaryItem]
-> ReadPrec ComplianceSummaryItem
-> ReadPrec [ComplianceSummaryItem]
-> Read ComplianceSummaryItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceSummaryItem]
$creadListPrec :: ReadPrec [ComplianceSummaryItem]
readPrec :: ReadPrec ComplianceSummaryItem
$creadPrec :: ReadPrec ComplianceSummaryItem
readList :: ReadS [ComplianceSummaryItem]
$creadList :: ReadS [ComplianceSummaryItem]
readsPrec :: Int -> ReadS ComplianceSummaryItem
$creadsPrec :: Int -> ReadS ComplianceSummaryItem
Prelude.Read, Int -> ComplianceSummaryItem -> ShowS
[ComplianceSummaryItem] -> ShowS
ComplianceSummaryItem -> String
(Int -> ComplianceSummaryItem -> ShowS)
-> (ComplianceSummaryItem -> String)
-> ([ComplianceSummaryItem] -> ShowS)
-> Show ComplianceSummaryItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceSummaryItem] -> ShowS
$cshowList :: [ComplianceSummaryItem] -> ShowS
show :: ComplianceSummaryItem -> String
$cshow :: ComplianceSummaryItem -> String
showsPrec :: Int -> ComplianceSummaryItem -> ShowS
$cshowsPrec :: Int -> ComplianceSummaryItem -> ShowS
Prelude.Show, (forall x. ComplianceSummaryItem -> Rep ComplianceSummaryItem x)
-> (forall x. Rep ComplianceSummaryItem x -> ComplianceSummaryItem)
-> Generic ComplianceSummaryItem
forall x. Rep ComplianceSummaryItem x -> ComplianceSummaryItem
forall x. ComplianceSummaryItem -> Rep ComplianceSummaryItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComplianceSummaryItem x -> ComplianceSummaryItem
$cfrom :: forall x. ComplianceSummaryItem -> Rep ComplianceSummaryItem x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceSummaryItem' 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:
--
-- 'nonCompliantSummary', 'complianceSummaryItem_nonCompliantSummary' - A list of NON_COMPLIANT items for the specified compliance type.
--
-- 'compliantSummary', 'complianceSummaryItem_compliantSummary' - A list of COMPLIANT items for the specified compliance type.
--
-- 'complianceType', 'complianceSummaryItem_complianceType' - The type of compliance item. For example, the compliance type can be
-- Association, Patch, or Custom:string.
newComplianceSummaryItem ::
  ComplianceSummaryItem
newComplianceSummaryItem :: ComplianceSummaryItem
newComplianceSummaryItem =
  ComplianceSummaryItem' :: Maybe NonCompliantSummary
-> Maybe CompliantSummary -> Maybe Text -> ComplianceSummaryItem
ComplianceSummaryItem'
    { $sel:nonCompliantSummary:ComplianceSummaryItem' :: Maybe NonCompliantSummary
nonCompliantSummary =
        Maybe NonCompliantSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:compliantSummary:ComplianceSummaryItem' :: Maybe CompliantSummary
compliantSummary = Maybe CompliantSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceType:ComplianceSummaryItem' :: Maybe Text
complianceType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of NON_COMPLIANT items for the specified compliance type.
complianceSummaryItem_nonCompliantSummary :: Lens.Lens' ComplianceSummaryItem (Prelude.Maybe NonCompliantSummary)
complianceSummaryItem_nonCompliantSummary :: (Maybe NonCompliantSummary -> f (Maybe NonCompliantSummary))
-> ComplianceSummaryItem -> f ComplianceSummaryItem
complianceSummaryItem_nonCompliantSummary = (ComplianceSummaryItem -> Maybe NonCompliantSummary)
-> (ComplianceSummaryItem
    -> Maybe NonCompliantSummary -> ComplianceSummaryItem)
-> Lens
     ComplianceSummaryItem
     ComplianceSummaryItem
     (Maybe NonCompliantSummary)
     (Maybe NonCompliantSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummaryItem' {Maybe NonCompliantSummary
nonCompliantSummary :: Maybe NonCompliantSummary
$sel:nonCompliantSummary:ComplianceSummaryItem' :: ComplianceSummaryItem -> Maybe NonCompliantSummary
nonCompliantSummary} -> Maybe NonCompliantSummary
nonCompliantSummary) (\s :: ComplianceSummaryItem
s@ComplianceSummaryItem' {} Maybe NonCompliantSummary
a -> ComplianceSummaryItem
s {$sel:nonCompliantSummary:ComplianceSummaryItem' :: Maybe NonCompliantSummary
nonCompliantSummary = Maybe NonCompliantSummary
a} :: ComplianceSummaryItem)

-- | A list of COMPLIANT items for the specified compliance type.
complianceSummaryItem_compliantSummary :: Lens.Lens' ComplianceSummaryItem (Prelude.Maybe CompliantSummary)
complianceSummaryItem_compliantSummary :: (Maybe CompliantSummary -> f (Maybe CompliantSummary))
-> ComplianceSummaryItem -> f ComplianceSummaryItem
complianceSummaryItem_compliantSummary = (ComplianceSummaryItem -> Maybe CompliantSummary)
-> (ComplianceSummaryItem
    -> Maybe CompliantSummary -> ComplianceSummaryItem)
-> Lens
     ComplianceSummaryItem
     ComplianceSummaryItem
     (Maybe CompliantSummary)
     (Maybe CompliantSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummaryItem' {Maybe CompliantSummary
compliantSummary :: Maybe CompliantSummary
$sel:compliantSummary:ComplianceSummaryItem' :: ComplianceSummaryItem -> Maybe CompliantSummary
compliantSummary} -> Maybe CompliantSummary
compliantSummary) (\s :: ComplianceSummaryItem
s@ComplianceSummaryItem' {} Maybe CompliantSummary
a -> ComplianceSummaryItem
s {$sel:compliantSummary:ComplianceSummaryItem' :: Maybe CompliantSummary
compliantSummary = Maybe CompliantSummary
a} :: ComplianceSummaryItem)

-- | The type of compliance item. For example, the compliance type can be
-- Association, Patch, or Custom:string.
complianceSummaryItem_complianceType :: Lens.Lens' ComplianceSummaryItem (Prelude.Maybe Prelude.Text)
complianceSummaryItem_complianceType :: (Maybe Text -> f (Maybe Text))
-> ComplianceSummaryItem -> f ComplianceSummaryItem
complianceSummaryItem_complianceType = (ComplianceSummaryItem -> Maybe Text)
-> (ComplianceSummaryItem -> Maybe Text -> ComplianceSummaryItem)
-> Lens
     ComplianceSummaryItem
     ComplianceSummaryItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummaryItem' {Maybe Text
complianceType :: Maybe Text
$sel:complianceType:ComplianceSummaryItem' :: ComplianceSummaryItem -> Maybe Text
complianceType} -> Maybe Text
complianceType) (\s :: ComplianceSummaryItem
s@ComplianceSummaryItem' {} Maybe Text
a -> ComplianceSummaryItem
s {$sel:complianceType:ComplianceSummaryItem' :: Maybe Text
complianceType = Maybe Text
a} :: ComplianceSummaryItem)

instance Core.FromJSON ComplianceSummaryItem where
  parseJSON :: Value -> Parser ComplianceSummaryItem
parseJSON =
    String
-> (Object -> Parser ComplianceSummaryItem)
-> Value
-> Parser ComplianceSummaryItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComplianceSummaryItem"
      ( \Object
x ->
          Maybe NonCompliantSummary
-> Maybe CompliantSummary -> Maybe Text -> ComplianceSummaryItem
ComplianceSummaryItem'
            (Maybe NonCompliantSummary
 -> Maybe CompliantSummary -> Maybe Text -> ComplianceSummaryItem)
-> Parser (Maybe NonCompliantSummary)
-> Parser
     (Maybe CompliantSummary -> Maybe Text -> ComplianceSummaryItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NonCompliantSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonCompliantSummary")
            Parser
  (Maybe CompliantSummary -> Maybe Text -> ComplianceSummaryItem)
-> Parser (Maybe CompliantSummary)
-> Parser (Maybe Text -> ComplianceSummaryItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CompliantSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompliantSummary")
            Parser (Maybe Text -> ComplianceSummaryItem)
-> Parser (Maybe Text) -> Parser ComplianceSummaryItem
forall (f :: * -> *) a b. Applicative f => 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
"ComplianceType")
      )

instance Prelude.Hashable ComplianceSummaryItem

instance Prelude.NFData ComplianceSummaryItem