{-# 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.Range where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Range = Range'
{
Range -> Maybe Integer
start :: Prelude.Maybe Prelude.Integer,
Range -> Maybe Integer
end :: Prelude.Maybe Prelude.Integer,
Range -> Maybe Integer
startColumn :: Prelude.Maybe Prelude.Integer
}
deriving (Range -> Range -> Bool
(Range -> Range -> Bool) -> (Range -> Range -> Bool) -> Eq Range
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Range -> Range -> Bool
$c/= :: Range -> Range -> Bool
== :: Range -> Range -> Bool
$c== :: Range -> Range -> Bool
Prelude.Eq, ReadPrec [Range]
ReadPrec Range
Int -> ReadS Range
ReadS [Range]
(Int -> ReadS Range)
-> ReadS [Range]
-> ReadPrec Range
-> ReadPrec [Range]
-> Read Range
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Range]
$creadListPrec :: ReadPrec [Range]
readPrec :: ReadPrec Range
$creadPrec :: ReadPrec Range
readList :: ReadS [Range]
$creadList :: ReadS [Range]
readsPrec :: Int -> ReadS Range
$creadsPrec :: Int -> ReadS Range
Prelude.Read, Int -> Range -> ShowS
[Range] -> ShowS
Range -> String
(Int -> Range -> ShowS)
-> (Range -> String) -> ([Range] -> ShowS) -> Show Range
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Range] -> ShowS
$cshowList :: [Range] -> ShowS
show :: Range -> String
$cshow :: Range -> String
showsPrec :: Int -> Range -> ShowS
$cshowsPrec :: Int -> Range -> ShowS
Prelude.Show, (forall x. Range -> Rep Range x)
-> (forall x. Rep Range x -> Range) -> Generic Range
forall x. Rep Range x -> Range
forall x. Range -> Rep Range x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Range x -> Range
$cfrom :: forall x. Range -> Rep Range x
Prelude.Generic)
newRange ::
Range
newRange :: Range
newRange =
Range' :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Range
Range'
{ $sel:start:Range' :: Maybe Integer
start = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:end:Range' :: Maybe Integer
end = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:startColumn:Range' :: Maybe Integer
startColumn = Maybe Integer
forall a. Maybe a
Prelude.Nothing
}
range_start :: Lens.Lens' Range (Prelude.Maybe Prelude.Integer)
range_start :: (Maybe Integer -> f (Maybe Integer)) -> Range -> f Range
range_start = (Range -> Maybe Integer)
-> (Range -> Maybe Integer -> Range)
-> Lens Range Range (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Range' {Maybe Integer
start :: Maybe Integer
$sel:start:Range' :: Range -> Maybe Integer
start} -> Maybe Integer
start) (\s :: Range
s@Range' {} Maybe Integer
a -> Range
s {$sel:start:Range' :: Maybe Integer
start = Maybe Integer
a} :: Range)
range_end :: Lens.Lens' Range (Prelude.Maybe Prelude.Integer)
range_end :: (Maybe Integer -> f (Maybe Integer)) -> Range -> f Range
range_end = (Range -> Maybe Integer)
-> (Range -> Maybe Integer -> Range)
-> Lens Range Range (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Range' {Maybe Integer
end :: Maybe Integer
$sel:end:Range' :: Range -> Maybe Integer
end} -> Maybe Integer
end) (\s :: Range
s@Range' {} Maybe Integer
a -> Range
s {$sel:end:Range' :: Maybe Integer
end = Maybe Integer
a} :: Range)
range_startColumn :: Lens.Lens' Range (Prelude.Maybe Prelude.Integer)
range_startColumn :: (Maybe Integer -> f (Maybe Integer)) -> Range -> f Range
range_startColumn = (Range -> Maybe Integer)
-> (Range -> Maybe Integer -> Range)
-> Lens Range Range (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Range' {Maybe Integer
startColumn :: Maybe Integer
$sel:startColumn:Range' :: Range -> Maybe Integer
startColumn} -> Maybe Integer
startColumn) (\s :: Range
s@Range' {} Maybe Integer
a -> Range
s {$sel:startColumn:Range' :: Maybe Integer
startColumn = Maybe Integer
a} :: Range)
instance Core.FromJSON Range where
parseJSON :: Value -> Parser Range
parseJSON =
String -> (Object -> Parser Range) -> Value -> Parser Range
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Range"
( \Object
x ->
Maybe Integer -> Maybe Integer -> Maybe Integer -> Range
Range'
(Maybe Integer -> Maybe Integer -> Maybe Integer -> Range)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> Range)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Start")
Parser (Maybe Integer -> Maybe Integer -> Range)
-> Parser (Maybe Integer) -> Parser (Maybe Integer -> Range)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"End")
Parser (Maybe Integer -> Range)
-> Parser (Maybe Integer) -> Parser Range
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartColumn")
)
instance Prelude.Hashable Range
instance Prelude.NFData Range
instance Core.ToJSON Range where
toJSON :: Range -> Value
toJSON Range' {Maybe Integer
startColumn :: Maybe Integer
end :: Maybe Integer
start :: Maybe Integer
$sel:startColumn:Range' :: Range -> Maybe Integer
$sel:end:Range' :: Range -> Maybe Integer
$sel:start:Range' :: Range -> Maybe Integer
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Start" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
start,
(Text
"End" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
end,
(Text
"StartColumn" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
startColumn
]
)