{-# 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 #-}
module Amazonka.SecurityHub.Types.Compliance where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.ComplianceStatus
import Amazonka.SecurityHub.Types.StatusReason
data Compliance = Compliance'
{
Compliance -> Maybe ComplianceStatus
status :: Prelude.Maybe ComplianceStatus,
Compliance -> Maybe [Text]
relatedRequirements :: Prelude.Maybe [Prelude.Text],
Compliance -> Maybe [StatusReason]
statusReasons :: Prelude.Maybe [StatusReason]
}
deriving (Compliance -> Compliance -> Bool
(Compliance -> Compliance -> Bool)
-> (Compliance -> Compliance -> Bool) -> Eq Compliance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Compliance -> Compliance -> Bool
$c/= :: Compliance -> Compliance -> Bool
== :: Compliance -> Compliance -> Bool
$c== :: Compliance -> Compliance -> Bool
Prelude.Eq, ReadPrec [Compliance]
ReadPrec Compliance
Int -> ReadS Compliance
ReadS [Compliance]
(Int -> ReadS Compliance)
-> ReadS [Compliance]
-> ReadPrec Compliance
-> ReadPrec [Compliance]
-> Read Compliance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Compliance]
$creadListPrec :: ReadPrec [Compliance]
readPrec :: ReadPrec Compliance
$creadPrec :: ReadPrec Compliance
readList :: ReadS [Compliance]
$creadList :: ReadS [Compliance]
readsPrec :: Int -> ReadS Compliance
$creadsPrec :: Int -> ReadS Compliance
Prelude.Read, Int -> Compliance -> ShowS
[Compliance] -> ShowS
Compliance -> String
(Int -> Compliance -> ShowS)
-> (Compliance -> String)
-> ([Compliance] -> ShowS)
-> Show Compliance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Compliance] -> ShowS
$cshowList :: [Compliance] -> ShowS
show :: Compliance -> String
$cshow :: Compliance -> String
showsPrec :: Int -> Compliance -> ShowS
$cshowsPrec :: Int -> Compliance -> ShowS
Prelude.Show, (forall x. Compliance -> Rep Compliance x)
-> (forall x. Rep Compliance x -> Compliance) -> Generic Compliance
forall x. Rep Compliance x -> Compliance
forall x. Compliance -> Rep Compliance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Compliance x -> Compliance
$cfrom :: forall x. Compliance -> Rep Compliance x
Prelude.Generic)
newCompliance ::
Compliance
newCompliance :: Compliance
newCompliance =
Compliance' :: Maybe ComplianceStatus
-> Maybe [Text] -> Maybe [StatusReason] -> Compliance
Compliance'
{ $sel:status:Compliance' :: Maybe ComplianceStatus
status = Maybe ComplianceStatus
forall a. Maybe a
Prelude.Nothing,
$sel:relatedRequirements:Compliance' :: Maybe [Text]
relatedRequirements = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:statusReasons:Compliance' :: Maybe [StatusReason]
statusReasons = Maybe [StatusReason]
forall a. Maybe a
Prelude.Nothing
}
compliance_status :: Lens.Lens' Compliance (Prelude.Maybe ComplianceStatus)
compliance_status :: (Maybe ComplianceStatus -> f (Maybe ComplianceStatus))
-> Compliance -> f Compliance
compliance_status = (Compliance -> Maybe ComplianceStatus)
-> (Compliance -> Maybe ComplianceStatus -> Compliance)
-> Lens
Compliance
Compliance
(Maybe ComplianceStatus)
(Maybe ComplianceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Compliance' {Maybe ComplianceStatus
status :: Maybe ComplianceStatus
$sel:status:Compliance' :: Compliance -> Maybe ComplianceStatus
status} -> Maybe ComplianceStatus
status) (\s :: Compliance
s@Compliance' {} Maybe ComplianceStatus
a -> Compliance
s {$sel:status:Compliance' :: Maybe ComplianceStatus
status = Maybe ComplianceStatus
a} :: Compliance)
compliance_relatedRequirements :: Lens.Lens' Compliance (Prelude.Maybe [Prelude.Text])
compliance_relatedRequirements :: (Maybe [Text] -> f (Maybe [Text])) -> Compliance -> f Compliance
compliance_relatedRequirements = (Compliance -> Maybe [Text])
-> (Compliance -> Maybe [Text] -> Compliance)
-> Lens Compliance Compliance (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Compliance' {Maybe [Text]
relatedRequirements :: Maybe [Text]
$sel:relatedRequirements:Compliance' :: Compliance -> Maybe [Text]
relatedRequirements} -> Maybe [Text]
relatedRequirements) (\s :: Compliance
s@Compliance' {} Maybe [Text]
a -> Compliance
s {$sel:relatedRequirements:Compliance' :: Maybe [Text]
relatedRequirements = Maybe [Text]
a} :: Compliance) ((Maybe [Text] -> f (Maybe [Text])) -> Compliance -> f Compliance)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Compliance
-> f Compliance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
compliance_statusReasons :: Lens.Lens' Compliance (Prelude.Maybe [StatusReason])
compliance_statusReasons :: (Maybe [StatusReason] -> f (Maybe [StatusReason]))
-> Compliance -> f Compliance
compliance_statusReasons = (Compliance -> Maybe [StatusReason])
-> (Compliance -> Maybe [StatusReason] -> Compliance)
-> Lens
Compliance Compliance (Maybe [StatusReason]) (Maybe [StatusReason])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Compliance' {Maybe [StatusReason]
statusReasons :: Maybe [StatusReason]
$sel:statusReasons:Compliance' :: Compliance -> Maybe [StatusReason]
statusReasons} -> Maybe [StatusReason]
statusReasons) (\s :: Compliance
s@Compliance' {} Maybe [StatusReason]
a -> Compliance
s {$sel:statusReasons:Compliance' :: Maybe [StatusReason]
statusReasons = Maybe [StatusReason]
a} :: Compliance) ((Maybe [StatusReason] -> f (Maybe [StatusReason]))
-> Compliance -> f Compliance)
-> ((Maybe [StatusReason] -> f (Maybe [StatusReason]))
-> Maybe [StatusReason] -> f (Maybe [StatusReason]))
-> (Maybe [StatusReason] -> f (Maybe [StatusReason]))
-> Compliance
-> f Compliance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [StatusReason] [StatusReason] [StatusReason] [StatusReason]
-> Iso
(Maybe [StatusReason])
(Maybe [StatusReason])
(Maybe [StatusReason])
(Maybe [StatusReason])
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 [StatusReason] [StatusReason] [StatusReason] [StatusReason]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Compliance where
parseJSON :: Value -> Parser Compliance
parseJSON =
String
-> (Object -> Parser Compliance) -> Value -> Parser Compliance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Compliance"
( \Object
x ->
Maybe ComplianceStatus
-> Maybe [Text] -> Maybe [StatusReason] -> Compliance
Compliance'
(Maybe ComplianceStatus
-> Maybe [Text] -> Maybe [StatusReason] -> Compliance)
-> Parser (Maybe ComplianceStatus)
-> Parser (Maybe [Text] -> Maybe [StatusReason] -> Compliance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ComplianceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
Parser (Maybe [Text] -> Maybe [StatusReason] -> Compliance)
-> Parser (Maybe [Text])
-> Parser (Maybe [StatusReason] -> Compliance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RelatedRequirements"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe [StatusReason] -> Compliance)
-> Parser (Maybe [StatusReason]) -> Parser Compliance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [StatusReason]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusReasons" Parser (Maybe (Maybe [StatusReason]))
-> Maybe [StatusReason] -> Parser (Maybe [StatusReason])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [StatusReason]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Compliance
instance Prelude.NFData Compliance
instance Core.ToJSON Compliance where
toJSON :: Compliance -> Value
toJSON Compliance' {Maybe [Text]
Maybe [StatusReason]
Maybe ComplianceStatus
statusReasons :: Maybe [StatusReason]
relatedRequirements :: Maybe [Text]
status :: Maybe ComplianceStatus
$sel:statusReasons:Compliance' :: Compliance -> Maybe [StatusReason]
$sel:relatedRequirements:Compliance' :: Compliance -> Maybe [Text]
$sel:status:Compliance' :: Compliance -> Maybe ComplianceStatus
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Status" Text -> ComplianceStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ComplianceStatus -> Pair) -> Maybe ComplianceStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ComplianceStatus
status,
(Text
"RelatedRequirements" 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]
relatedRequirements,
(Text
"StatusReasons" Text -> [StatusReason] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([StatusReason] -> Pair) -> Maybe [StatusReason] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StatusReason]
statusReasons
]
)