{-# 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.Occurrences where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.Cell
import Amazonka.SecurityHub.Types.Page
import Amazonka.SecurityHub.Types.Range
import Amazonka.SecurityHub.Types.Record
data Occurrences = Occurrences'
{
Occurrences -> Maybe [Range]
lineRanges :: Prelude.Maybe [Range],
Occurrences -> Maybe [Cell]
cells :: Prelude.Maybe [Cell],
Occurrences -> Maybe [Page]
pages :: Prelude.Maybe [Page],
Occurrences -> Maybe [Record]
records :: Prelude.Maybe [Record],
Occurrences -> Maybe [Range]
offsetRanges :: Prelude.Maybe [Range]
}
deriving (Occurrences -> Occurrences -> Bool
(Occurrences -> Occurrences -> Bool)
-> (Occurrences -> Occurrences -> Bool) -> Eq Occurrences
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Occurrences -> Occurrences -> Bool
$c/= :: Occurrences -> Occurrences -> Bool
== :: Occurrences -> Occurrences -> Bool
$c== :: Occurrences -> Occurrences -> Bool
Prelude.Eq, ReadPrec [Occurrences]
ReadPrec Occurrences
Int -> ReadS Occurrences
ReadS [Occurrences]
(Int -> ReadS Occurrences)
-> ReadS [Occurrences]
-> ReadPrec Occurrences
-> ReadPrec [Occurrences]
-> Read Occurrences
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Occurrences]
$creadListPrec :: ReadPrec [Occurrences]
readPrec :: ReadPrec Occurrences
$creadPrec :: ReadPrec Occurrences
readList :: ReadS [Occurrences]
$creadList :: ReadS [Occurrences]
readsPrec :: Int -> ReadS Occurrences
$creadsPrec :: Int -> ReadS Occurrences
Prelude.Read, Int -> Occurrences -> ShowS
[Occurrences] -> ShowS
Occurrences -> String
(Int -> Occurrences -> ShowS)
-> (Occurrences -> String)
-> ([Occurrences] -> ShowS)
-> Show Occurrences
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Occurrences] -> ShowS
$cshowList :: [Occurrences] -> ShowS
show :: Occurrences -> String
$cshow :: Occurrences -> String
showsPrec :: Int -> Occurrences -> ShowS
$cshowsPrec :: Int -> Occurrences -> ShowS
Prelude.Show, (forall x. Occurrences -> Rep Occurrences x)
-> (forall x. Rep Occurrences x -> Occurrences)
-> Generic Occurrences
forall x. Rep Occurrences x -> Occurrences
forall x. Occurrences -> Rep Occurrences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Occurrences x -> Occurrences
$cfrom :: forall x. Occurrences -> Rep Occurrences x
Prelude.Generic)
newOccurrences ::
Occurrences
newOccurrences :: Occurrences
newOccurrences =
Occurrences' :: Maybe [Range]
-> Maybe [Cell]
-> Maybe [Page]
-> Maybe [Record]
-> Maybe [Range]
-> Occurrences
Occurrences'
{ $sel:lineRanges:Occurrences' :: Maybe [Range]
lineRanges = Maybe [Range]
forall a. Maybe a
Prelude.Nothing,
$sel:cells:Occurrences' :: Maybe [Cell]
cells = Maybe [Cell]
forall a. Maybe a
Prelude.Nothing,
$sel:pages:Occurrences' :: Maybe [Page]
pages = Maybe [Page]
forall a. Maybe a
Prelude.Nothing,
$sel:records:Occurrences' :: Maybe [Record]
records = Maybe [Record]
forall a. Maybe a
Prelude.Nothing,
$sel:offsetRanges:Occurrences' :: Maybe [Range]
offsetRanges = Maybe [Range]
forall a. Maybe a
Prelude.Nothing
}
occurrences_lineRanges :: Lens.Lens' Occurrences (Prelude.Maybe [Range])
occurrences_lineRanges :: (Maybe [Range] -> f (Maybe [Range]))
-> Occurrences -> f Occurrences
occurrences_lineRanges = (Occurrences -> Maybe [Range])
-> (Occurrences -> Maybe [Range] -> Occurrences)
-> Lens Occurrences Occurrences (Maybe [Range]) (Maybe [Range])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Range]
lineRanges :: Maybe [Range]
$sel:lineRanges:Occurrences' :: Occurrences -> Maybe [Range]
lineRanges} -> Maybe [Range]
lineRanges) (\s :: Occurrences
s@Occurrences' {} Maybe [Range]
a -> Occurrences
s {$sel:lineRanges:Occurrences' :: Maybe [Range]
lineRanges = Maybe [Range]
a} :: Occurrences) ((Maybe [Range] -> f (Maybe [Range]))
-> Occurrences -> f Occurrences)
-> ((Maybe [Range] -> f (Maybe [Range]))
-> Maybe [Range] -> f (Maybe [Range]))
-> (Maybe [Range] -> f (Maybe [Range]))
-> Occurrences
-> f Occurrences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Range] [Range] [Range] [Range]
-> Iso
(Maybe [Range]) (Maybe [Range]) (Maybe [Range]) (Maybe [Range])
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 [Range] [Range] [Range] [Range]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
occurrences_cells :: Lens.Lens' Occurrences (Prelude.Maybe [Cell])
occurrences_cells :: (Maybe [Cell] -> f (Maybe [Cell])) -> Occurrences -> f Occurrences
occurrences_cells = (Occurrences -> Maybe [Cell])
-> (Occurrences -> Maybe [Cell] -> Occurrences)
-> Lens Occurrences Occurrences (Maybe [Cell]) (Maybe [Cell])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Cell]
cells :: Maybe [Cell]
$sel:cells:Occurrences' :: Occurrences -> Maybe [Cell]
cells} -> Maybe [Cell]
cells) (\s :: Occurrences
s@Occurrences' {} Maybe [Cell]
a -> Occurrences
s {$sel:cells:Occurrences' :: Maybe [Cell]
cells = Maybe [Cell]
a} :: Occurrences) ((Maybe [Cell] -> f (Maybe [Cell]))
-> Occurrences -> f Occurrences)
-> ((Maybe [Cell] -> f (Maybe [Cell]))
-> Maybe [Cell] -> f (Maybe [Cell]))
-> (Maybe [Cell] -> f (Maybe [Cell]))
-> Occurrences
-> f Occurrences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Cell] [Cell] [Cell] [Cell]
-> Iso (Maybe [Cell]) (Maybe [Cell]) (Maybe [Cell]) (Maybe [Cell])
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 [Cell] [Cell] [Cell] [Cell]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
occurrences_pages :: Lens.Lens' Occurrences (Prelude.Maybe [Page])
occurrences_pages :: (Maybe [Page] -> f (Maybe [Page])) -> Occurrences -> f Occurrences
occurrences_pages = (Occurrences -> Maybe [Page])
-> (Occurrences -> Maybe [Page] -> Occurrences)
-> Lens Occurrences Occurrences (Maybe [Page]) (Maybe [Page])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Page]
pages :: Maybe [Page]
$sel:pages:Occurrences' :: Occurrences -> Maybe [Page]
pages} -> Maybe [Page]
pages) (\s :: Occurrences
s@Occurrences' {} Maybe [Page]
a -> Occurrences
s {$sel:pages:Occurrences' :: Maybe [Page]
pages = Maybe [Page]
a} :: Occurrences) ((Maybe [Page] -> f (Maybe [Page]))
-> Occurrences -> f Occurrences)
-> ((Maybe [Page] -> f (Maybe [Page]))
-> Maybe [Page] -> f (Maybe [Page]))
-> (Maybe [Page] -> f (Maybe [Page]))
-> Occurrences
-> f Occurrences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Page] [Page] [Page] [Page]
-> Iso (Maybe [Page]) (Maybe [Page]) (Maybe [Page]) (Maybe [Page])
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 [Page] [Page] [Page] [Page]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
occurrences_records :: Lens.Lens' Occurrences (Prelude.Maybe [Record])
occurrences_records :: (Maybe [Record] -> f (Maybe [Record]))
-> Occurrences -> f Occurrences
occurrences_records = (Occurrences -> Maybe [Record])
-> (Occurrences -> Maybe [Record] -> Occurrences)
-> Lens Occurrences Occurrences (Maybe [Record]) (Maybe [Record])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Record]
records :: Maybe [Record]
$sel:records:Occurrences' :: Occurrences -> Maybe [Record]
records} -> Maybe [Record]
records) (\s :: Occurrences
s@Occurrences' {} Maybe [Record]
a -> Occurrences
s {$sel:records:Occurrences' :: Maybe [Record]
records = Maybe [Record]
a} :: Occurrences) ((Maybe [Record] -> f (Maybe [Record]))
-> Occurrences -> f Occurrences)
-> ((Maybe [Record] -> f (Maybe [Record]))
-> Maybe [Record] -> f (Maybe [Record]))
-> (Maybe [Record] -> f (Maybe [Record]))
-> Occurrences
-> f Occurrences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Record] [Record] [Record] [Record]
-> Iso
(Maybe [Record]) (Maybe [Record]) (Maybe [Record]) (Maybe [Record])
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 [Record] [Record] [Record] [Record]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
occurrences_offsetRanges :: Lens.Lens' Occurrences (Prelude.Maybe [Range])
occurrences_offsetRanges :: (Maybe [Range] -> f (Maybe [Range]))
-> Occurrences -> f Occurrences
occurrences_offsetRanges = (Occurrences -> Maybe [Range])
-> (Occurrences -> Maybe [Range] -> Occurrences)
-> Lens Occurrences Occurrences (Maybe [Range]) (Maybe [Range])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Range]
offsetRanges :: Maybe [Range]
$sel:offsetRanges:Occurrences' :: Occurrences -> Maybe [Range]
offsetRanges} -> Maybe [Range]
offsetRanges) (\s :: Occurrences
s@Occurrences' {} Maybe [Range]
a -> Occurrences
s {$sel:offsetRanges:Occurrences' :: Maybe [Range]
offsetRanges = Maybe [Range]
a} :: Occurrences) ((Maybe [Range] -> f (Maybe [Range]))
-> Occurrences -> f Occurrences)
-> ((Maybe [Range] -> f (Maybe [Range]))
-> Maybe [Range] -> f (Maybe [Range]))
-> (Maybe [Range] -> f (Maybe [Range]))
-> Occurrences
-> f Occurrences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Range] [Range] [Range] [Range]
-> Iso
(Maybe [Range]) (Maybe [Range]) (Maybe [Range]) (Maybe [Range])
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 [Range] [Range] [Range] [Range]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Occurrences where
parseJSON :: Value -> Parser Occurrences
parseJSON =
String
-> (Object -> Parser Occurrences) -> Value -> Parser Occurrences
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Occurrences"
( \Object
x ->
Maybe [Range]
-> Maybe [Cell]
-> Maybe [Page]
-> Maybe [Record]
-> Maybe [Range]
-> Occurrences
Occurrences'
(Maybe [Range]
-> Maybe [Cell]
-> Maybe [Page]
-> Maybe [Record]
-> Maybe [Range]
-> Occurrences)
-> Parser (Maybe [Range])
-> Parser
(Maybe [Cell]
-> Maybe [Page] -> Maybe [Record] -> Maybe [Range] -> Occurrences)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Range]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LineRanges" Parser (Maybe (Maybe [Range]))
-> Maybe [Range] -> Parser (Maybe [Range])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Range]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe [Cell]
-> Maybe [Page] -> Maybe [Record] -> Maybe [Range] -> Occurrences)
-> Parser (Maybe [Cell])
-> Parser
(Maybe [Page] -> Maybe [Record] -> Maybe [Range] -> Occurrences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Cell]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Cells" Parser (Maybe (Maybe [Cell]))
-> Maybe [Cell] -> Parser (Maybe [Cell])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Cell]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe [Page] -> Maybe [Record] -> Maybe [Range] -> Occurrences)
-> Parser (Maybe [Page])
-> Parser (Maybe [Record] -> Maybe [Range] -> Occurrences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Page]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Pages" Parser (Maybe (Maybe [Page]))
-> Maybe [Page] -> Parser (Maybe [Page])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Page]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [Record] -> Maybe [Range] -> Occurrences)
-> Parser (Maybe [Record]) -> Parser (Maybe [Range] -> Occurrences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Record]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Records" Parser (Maybe (Maybe [Record]))
-> Maybe [Record] -> Parser (Maybe [Record])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Record]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [Range] -> Occurrences)
-> Parser (Maybe [Range]) -> Parser Occurrences
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Range]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OffsetRanges" Parser (Maybe (Maybe [Range]))
-> Maybe [Range] -> Parser (Maybe [Range])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Range]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Occurrences
instance Prelude.NFData Occurrences
instance Core.ToJSON Occurrences where
toJSON :: Occurrences -> Value
toJSON Occurrences' {Maybe [Cell]
Maybe [Range]
Maybe [Page]
Maybe [Record]
offsetRanges :: Maybe [Range]
records :: Maybe [Record]
pages :: Maybe [Page]
cells :: Maybe [Cell]
lineRanges :: Maybe [Range]
$sel:offsetRanges:Occurrences' :: Occurrences -> Maybe [Range]
$sel:records:Occurrences' :: Occurrences -> Maybe [Record]
$sel:pages:Occurrences' :: Occurrences -> Maybe [Page]
$sel:cells:Occurrences' :: Occurrences -> Maybe [Cell]
$sel:lineRanges:Occurrences' :: Occurrences -> Maybe [Range]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LineRanges" Text -> [Range] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Range] -> Pair) -> Maybe [Range] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Range]
lineRanges,
(Text
"Cells" Text -> [Cell] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Cell] -> Pair) -> Maybe [Cell] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Cell]
cells,
(Text
"Pages" Text -> [Page] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Page] -> Pair) -> Maybe [Page] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Page]
pages,
(Text
"Records" Text -> [Record] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Record] -> Pair) -> Maybe [Record] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Record]
records,
(Text
"OffsetRanges" Text -> [Range] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Range] -> Pair) -> Maybe [Range] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Range]
offsetRanges
]
)