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