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