{-# 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.Snowball.Types.KeyRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KeyRange = KeyRange'
{
KeyRange -> Maybe Text
endMarker :: Prelude.Maybe Prelude.Text,
KeyRange -> Maybe Text
beginMarker :: Prelude.Maybe Prelude.Text
}
deriving (KeyRange -> KeyRange -> Bool
(KeyRange -> KeyRange -> Bool)
-> (KeyRange -> KeyRange -> Bool) -> Eq KeyRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyRange -> KeyRange -> Bool
$c/= :: KeyRange -> KeyRange -> Bool
== :: KeyRange -> KeyRange -> Bool
$c== :: KeyRange -> KeyRange -> Bool
Prelude.Eq, ReadPrec [KeyRange]
ReadPrec KeyRange
Int -> ReadS KeyRange
ReadS [KeyRange]
(Int -> ReadS KeyRange)
-> ReadS [KeyRange]
-> ReadPrec KeyRange
-> ReadPrec [KeyRange]
-> Read KeyRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyRange]
$creadListPrec :: ReadPrec [KeyRange]
readPrec :: ReadPrec KeyRange
$creadPrec :: ReadPrec KeyRange
readList :: ReadS [KeyRange]
$creadList :: ReadS [KeyRange]
readsPrec :: Int -> ReadS KeyRange
$creadsPrec :: Int -> ReadS KeyRange
Prelude.Read, Int -> KeyRange -> ShowS
[KeyRange] -> ShowS
KeyRange -> String
(Int -> KeyRange -> ShowS)
-> (KeyRange -> String) -> ([KeyRange] -> ShowS) -> Show KeyRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyRange] -> ShowS
$cshowList :: [KeyRange] -> ShowS
show :: KeyRange -> String
$cshow :: KeyRange -> String
showsPrec :: Int -> KeyRange -> ShowS
$cshowsPrec :: Int -> KeyRange -> ShowS
Prelude.Show, (forall x. KeyRange -> Rep KeyRange x)
-> (forall x. Rep KeyRange x -> KeyRange) -> Generic KeyRange
forall x. Rep KeyRange x -> KeyRange
forall x. KeyRange -> Rep KeyRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyRange x -> KeyRange
$cfrom :: forall x. KeyRange -> Rep KeyRange x
Prelude.Generic)
newKeyRange ::
KeyRange
newKeyRange :: KeyRange
newKeyRange =
KeyRange' :: Maybe Text -> Maybe Text -> KeyRange
KeyRange'
{ $sel:endMarker:KeyRange' :: Maybe Text
endMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:beginMarker:KeyRange' :: Maybe Text
beginMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
keyRange_endMarker :: Lens.Lens' KeyRange (Prelude.Maybe Prelude.Text)
keyRange_endMarker :: (Maybe Text -> f (Maybe Text)) -> KeyRange -> f KeyRange
keyRange_endMarker = (KeyRange -> Maybe Text)
-> (KeyRange -> Maybe Text -> KeyRange)
-> Lens KeyRange KeyRange (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyRange' {Maybe Text
endMarker :: Maybe Text
$sel:endMarker:KeyRange' :: KeyRange -> Maybe Text
endMarker} -> Maybe Text
endMarker) (\s :: KeyRange
s@KeyRange' {} Maybe Text
a -> KeyRange
s {$sel:endMarker:KeyRange' :: Maybe Text
endMarker = Maybe Text
a} :: KeyRange)
keyRange_beginMarker :: Lens.Lens' KeyRange (Prelude.Maybe Prelude.Text)
keyRange_beginMarker :: (Maybe Text -> f (Maybe Text)) -> KeyRange -> f KeyRange
keyRange_beginMarker = (KeyRange -> Maybe Text)
-> (KeyRange -> Maybe Text -> KeyRange)
-> Lens KeyRange KeyRange (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyRange' {Maybe Text
beginMarker :: Maybe Text
$sel:beginMarker:KeyRange' :: KeyRange -> Maybe Text
beginMarker} -> Maybe Text
beginMarker) (\s :: KeyRange
s@KeyRange' {} Maybe Text
a -> KeyRange
s {$sel:beginMarker:KeyRange' :: Maybe Text
beginMarker = Maybe Text
a} :: KeyRange)
instance Core.FromJSON KeyRange where
parseJSON :: Value -> Parser KeyRange
parseJSON =
String -> (Object -> Parser KeyRange) -> Value -> Parser KeyRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KeyRange"
( \Object
x ->
Maybe Text -> Maybe Text -> KeyRange
KeyRange'
(Maybe Text -> Maybe Text -> KeyRange)
-> Parser (Maybe Text) -> Parser (Maybe Text -> KeyRange)
forall (f :: * -> *) a b. Functor 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
"EndMarker")
Parser (Maybe Text -> KeyRange)
-> Parser (Maybe Text) -> Parser KeyRange
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
"BeginMarker")
)
instance Prelude.Hashable KeyRange
instance Prelude.NFData KeyRange
instance Core.ToJSON KeyRange where
toJSON :: KeyRange -> Value
toJSON KeyRange' {Maybe Text
beginMarker :: Maybe Text
endMarker :: Maybe Text
$sel:beginMarker:KeyRange' :: KeyRange -> Maybe Text
$sel:endMarker:KeyRange' :: KeyRange -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EndMarker" 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
endMarker,
(Text
"BeginMarker" 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
beginMarker
]
)