{-# 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.SageMakerGeoSpatial.Types.Operation 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.SageMakerGeoSpatial.Types.OutputType
data Operation = Operation'
{
Operation -> Maybe OutputType
outputType :: Prelude.Maybe OutputType,
Operation -> Text
equation :: Prelude.Text,
Operation -> Text
name :: Prelude.Text
}
deriving (Operation -> Operation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Operation -> Operation -> Bool
$c/= :: Operation -> Operation -> Bool
== :: Operation -> Operation -> Bool
$c== :: Operation -> Operation -> Bool
Prelude.Eq, ReadPrec [Operation]
ReadPrec Operation
Int -> ReadS Operation
ReadS [Operation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Operation]
$creadListPrec :: ReadPrec [Operation]
readPrec :: ReadPrec Operation
$creadPrec :: ReadPrec Operation
readList :: ReadS [Operation]
$creadList :: ReadS [Operation]
readsPrec :: Int -> ReadS Operation
$creadsPrec :: Int -> ReadS Operation
Prelude.Read, Int -> Operation -> ShowS
[Operation] -> ShowS
Operation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Operation] -> ShowS
$cshowList :: [Operation] -> ShowS
show :: Operation -> String
$cshow :: Operation -> String
showsPrec :: Int -> Operation -> ShowS
$cshowsPrec :: Int -> Operation -> ShowS
Prelude.Show, forall x. Rep Operation x -> Operation
forall x. Operation -> Rep Operation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Operation x -> Operation
$cfrom :: forall x. Operation -> Rep Operation x
Prelude.Generic)
newOperation ::
Prelude.Text ->
Prelude.Text ->
Operation
newOperation :: Text -> Text -> Operation
newOperation Text
pEquation_ Text
pName_ =
Operation'
{ $sel:outputType:Operation' :: Maybe OutputType
outputType = forall a. Maybe a
Prelude.Nothing,
$sel:equation:Operation' :: Text
equation = Text
pEquation_,
$sel:name:Operation' :: Text
name = Text
pName_
}
operation_outputType :: Lens.Lens' Operation (Prelude.Maybe OutputType)
operation_outputType :: Lens' Operation (Maybe OutputType)
operation_outputType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Operation' {Maybe OutputType
outputType :: Maybe OutputType
$sel:outputType:Operation' :: Operation -> Maybe OutputType
outputType} -> Maybe OutputType
outputType) (\s :: Operation
s@Operation' {} Maybe OutputType
a -> Operation
s {$sel:outputType:Operation' :: Maybe OutputType
outputType = Maybe OutputType
a} :: Operation)
operation_equation :: Lens.Lens' Operation Prelude.Text
operation_equation :: Lens' Operation Text
operation_equation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Operation' {Text
equation :: Text
$sel:equation:Operation' :: Operation -> Text
equation} -> Text
equation) (\s :: Operation
s@Operation' {} Text
a -> Operation
s {$sel:equation:Operation' :: Text
equation = Text
a} :: Operation)
operation_name :: Lens.Lens' Operation Prelude.Text
operation_name :: Lens' Operation Text
operation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Operation' {Text
name :: Text
$sel:name:Operation' :: Operation -> Text
name} -> Text
name) (\s :: Operation
s@Operation' {} Text
a -> Operation
s {$sel:name:Operation' :: Text
name = Text
a} :: Operation)
instance Data.FromJSON Operation where
parseJSON :: Value -> Parser Operation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Operation"
( \Object
x ->
Maybe OutputType -> Text -> Text -> Operation
Operation'
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
"OutputType")
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
"Equation")
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
"Name")
)
instance Prelude.Hashable Operation where
hashWithSalt :: Int -> Operation -> Int
hashWithSalt Int
_salt Operation' {Maybe OutputType
Text
name :: Text
equation :: Text
outputType :: Maybe OutputType
$sel:name:Operation' :: Operation -> Text
$sel:equation:Operation' :: Operation -> Text
$sel:outputType:Operation' :: Operation -> Maybe OutputType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutputType
outputType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
equation
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData Operation where
rnf :: Operation -> ()
rnf Operation' {Maybe OutputType
Text
name :: Text
equation :: Text
outputType :: Maybe OutputType
$sel:name:Operation' :: Operation -> Text
$sel:equation:Operation' :: Operation -> Text
$sel:outputType:Operation' :: Operation -> Maybe OutputType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe OutputType
outputType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
equation
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToJSON Operation where
toJSON :: Operation -> Value
toJSON Operation' {Maybe OutputType
Text
name :: Text
equation :: Text
outputType :: Maybe OutputType
$sel:name:Operation' :: Operation -> Text
$sel:equation:Operation' :: Operation -> Text
$sel:outputType:Operation' :: Operation -> Maybe OutputType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"OutputType" 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 OutputType
outputType,
forall a. a -> Maybe a
Prelude.Just (Key
"Equation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
equation),
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)