{-# 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.Sample where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.SampleType
import qualified Amazonka.Prelude as Prelude
data Sample = Sample'
{
Sample -> Maybe Natural
size :: Prelude.Maybe Prelude.Natural,
Sample -> SampleType
type' :: SampleType
}
deriving (Sample -> Sample -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sample -> Sample -> Bool
$c/= :: Sample -> Sample -> Bool
== :: Sample -> Sample -> Bool
$c== :: Sample -> Sample -> Bool
Prelude.Eq, ReadPrec [Sample]
ReadPrec Sample
Int -> ReadS Sample
ReadS [Sample]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Sample]
$creadListPrec :: ReadPrec [Sample]
readPrec :: ReadPrec Sample
$creadPrec :: ReadPrec Sample
readList :: ReadS [Sample]
$creadList :: ReadS [Sample]
readsPrec :: Int -> ReadS Sample
$creadsPrec :: Int -> ReadS Sample
Prelude.Read, Int -> Sample -> ShowS
[Sample] -> ShowS
Sample -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sample] -> ShowS
$cshowList :: [Sample] -> ShowS
show :: Sample -> String
$cshow :: Sample -> String
showsPrec :: Int -> Sample -> ShowS
$cshowsPrec :: Int -> Sample -> ShowS
Prelude.Show, forall x. Rep Sample x -> Sample
forall x. Sample -> Rep Sample x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Sample x -> Sample
$cfrom :: forall x. Sample -> Rep Sample x
Prelude.Generic)
newSample ::
SampleType ->
Sample
newSample :: SampleType -> Sample
newSample SampleType
pType_ =
Sample' {$sel:size:Sample' :: Maybe Natural
size = forall a. Maybe a
Prelude.Nothing, $sel:type':Sample' :: SampleType
type' = SampleType
pType_}
sample_size :: Lens.Lens' Sample (Prelude.Maybe Prelude.Natural)
sample_size :: Lens' Sample (Maybe Natural)
sample_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sample' {Maybe Natural
size :: Maybe Natural
$sel:size:Sample' :: Sample -> Maybe Natural
size} -> Maybe Natural
size) (\s :: Sample
s@Sample' {} Maybe Natural
a -> Sample
s {$sel:size:Sample' :: Maybe Natural
size = Maybe Natural
a} :: Sample)
sample_type :: Lens.Lens' Sample SampleType
sample_type :: Lens' Sample SampleType
sample_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sample' {SampleType
type' :: SampleType
$sel:type':Sample' :: Sample -> SampleType
type'} -> SampleType
type') (\s :: Sample
s@Sample' {} SampleType
a -> Sample
s {$sel:type':Sample' :: SampleType
type' = SampleType
a} :: Sample)
instance Data.FromJSON Sample where
parseJSON :: Value -> Parser Sample
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Sample"
( \Object
x ->
Maybe Natural -> SampleType -> Sample
Sample'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Size")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
)
instance Prelude.Hashable Sample where
hashWithSalt :: Int -> Sample -> Int
hashWithSalt Int
_salt Sample' {Maybe Natural
SampleType
type' :: SampleType
size :: Maybe Natural
$sel:type':Sample' :: Sample -> SampleType
$sel:size:Sample' :: Sample -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
size
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SampleType
type'
instance Prelude.NFData Sample where
rnf :: Sample -> ()
rnf Sample' {Maybe Natural
SampleType
type' :: SampleType
size :: Maybe Natural
$sel:type':Sample' :: Sample -> SampleType
$sel:size:Sample' :: Sample -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
size seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SampleType
type'
instance Data.ToJSON Sample where
toJSON :: Sample -> Value
toJSON Sample' {Maybe Natural
SampleType
type' :: SampleType
size :: Maybe Natural
$sel:type':Sample' :: Sample -> SampleType
$sel:size:Sample' :: Sample -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Size" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
size,
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SampleType
type')
]
)