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