{-# 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.Glue.Types.Spigot 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
data Spigot = Spigot'
{
Spigot -> Maybe Double
prob :: Prelude.Maybe Prelude.Double,
Spigot -> Maybe Natural
topk :: Prelude.Maybe Prelude.Natural,
Spigot -> Text
name :: Prelude.Text,
Spigot -> NonEmpty Text
inputs :: Prelude.NonEmpty Prelude.Text,
Spigot -> Text
path :: Prelude.Text
}
deriving (Spigot -> Spigot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Spigot -> Spigot -> Bool
$c/= :: Spigot -> Spigot -> Bool
== :: Spigot -> Spigot -> Bool
$c== :: Spigot -> Spigot -> Bool
Prelude.Eq, ReadPrec [Spigot]
ReadPrec Spigot
Int -> ReadS Spigot
ReadS [Spigot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Spigot]
$creadListPrec :: ReadPrec [Spigot]
readPrec :: ReadPrec Spigot
$creadPrec :: ReadPrec Spigot
readList :: ReadS [Spigot]
$creadList :: ReadS [Spigot]
readsPrec :: Int -> ReadS Spigot
$creadsPrec :: Int -> ReadS Spigot
Prelude.Read, Int -> Spigot -> ShowS
[Spigot] -> ShowS
Spigot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Spigot] -> ShowS
$cshowList :: [Spigot] -> ShowS
show :: Spigot -> String
$cshow :: Spigot -> String
showsPrec :: Int -> Spigot -> ShowS
$cshowsPrec :: Int -> Spigot -> ShowS
Prelude.Show, forall x. Rep Spigot x -> Spigot
forall x. Spigot -> Rep Spigot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Spigot x -> Spigot
$cfrom :: forall x. Spigot -> Rep Spigot x
Prelude.Generic)
newSpigot ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
Prelude.Text ->
Spigot
newSpigot :: Text -> NonEmpty Text -> Text -> Spigot
newSpigot Text
pName_ NonEmpty Text
pInputs_ Text
pPath_ =
Spigot'
{ $sel:prob:Spigot' :: Maybe Double
prob = forall a. Maybe a
Prelude.Nothing,
$sel:topk:Spigot' :: Maybe Natural
topk = forall a. Maybe a
Prelude.Nothing,
$sel:name:Spigot' :: Text
name = Text
pName_,
$sel:inputs:Spigot' :: NonEmpty Text
inputs = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pInputs_,
$sel:path:Spigot' :: Text
path = Text
pPath_
}
spigot_prob :: Lens.Lens' Spigot (Prelude.Maybe Prelude.Double)
spigot_prob :: Lens' Spigot (Maybe Double)
spigot_prob = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Spigot' {Maybe Double
prob :: Maybe Double
$sel:prob:Spigot' :: Spigot -> Maybe Double
prob} -> Maybe Double
prob) (\s :: Spigot
s@Spigot' {} Maybe Double
a -> Spigot
s {$sel:prob:Spigot' :: Maybe Double
prob = Maybe Double
a} :: Spigot)
spigot_topk :: Lens.Lens' Spigot (Prelude.Maybe Prelude.Natural)
spigot_topk :: Lens' Spigot (Maybe Natural)
spigot_topk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Spigot' {Maybe Natural
topk :: Maybe Natural
$sel:topk:Spigot' :: Spigot -> Maybe Natural
topk} -> Maybe Natural
topk) (\s :: Spigot
s@Spigot' {} Maybe Natural
a -> Spigot
s {$sel:topk:Spigot' :: Maybe Natural
topk = Maybe Natural
a} :: Spigot)
spigot_name :: Lens.Lens' Spigot Prelude.Text
spigot_name :: Lens' Spigot Text
spigot_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Spigot' {Text
name :: Text
$sel:name:Spigot' :: Spigot -> Text
name} -> Text
name) (\s :: Spigot
s@Spigot' {} Text
a -> Spigot
s {$sel:name:Spigot' :: Text
name = Text
a} :: Spigot)
spigot_inputs :: Lens.Lens' Spigot (Prelude.NonEmpty Prelude.Text)
spigot_inputs :: Lens' Spigot (NonEmpty Text)
spigot_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Spigot' {NonEmpty Text
inputs :: NonEmpty Text
$sel:inputs:Spigot' :: Spigot -> NonEmpty Text
inputs} -> NonEmpty Text
inputs) (\s :: Spigot
s@Spigot' {} NonEmpty Text
a -> Spigot
s {$sel:inputs:Spigot' :: NonEmpty Text
inputs = NonEmpty Text
a} :: Spigot) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
spigot_path :: Lens.Lens' Spigot Prelude.Text
spigot_path :: Lens' Spigot Text
spigot_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Spigot' {Text
path :: Text
$sel:path:Spigot' :: Spigot -> Text
path} -> Text
path) (\s :: Spigot
s@Spigot' {} Text
a -> Spigot
s {$sel:path:Spigot' :: Text
path = Text
a} :: Spigot)
instance Data.FromJSON Spigot where
parseJSON :: Value -> Parser Spigot
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Spigot"
( \Object
x ->
Maybe Double
-> Maybe Natural -> Text -> NonEmpty Text -> Text -> Spigot
Spigot'
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
"Prob")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Topk")
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")
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
"Inputs")
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
"Path")
)
instance Prelude.Hashable Spigot where
hashWithSalt :: Int -> Spigot -> Int
hashWithSalt Int
_salt Spigot' {Maybe Double
Maybe Natural
NonEmpty Text
Text
path :: Text
inputs :: NonEmpty Text
name :: Text
topk :: Maybe Natural
prob :: Maybe Double
$sel:path:Spigot' :: Spigot -> Text
$sel:inputs:Spigot' :: Spigot -> NonEmpty Text
$sel:name:Spigot' :: Spigot -> Text
$sel:topk:Spigot' :: Spigot -> Maybe Natural
$sel:prob:Spigot' :: Spigot -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
prob
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
topk
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
inputs
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
path
instance Prelude.NFData Spigot where
rnf :: Spigot -> ()
rnf Spigot' {Maybe Double
Maybe Natural
NonEmpty Text
Text
path :: Text
inputs :: NonEmpty Text
name :: Text
topk :: Maybe Natural
prob :: Maybe Double
$sel:path:Spigot' :: Spigot -> Text
$sel:inputs:Spigot' :: Spigot -> NonEmpty Text
$sel:name:Spigot' :: Spigot -> Text
$sel:topk:Spigot' :: Spigot -> Maybe Natural
$sel:prob:Spigot' :: Spigot -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
prob
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
topk
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
inputs
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
path
instance Data.ToJSON Spigot where
toJSON :: Spigot -> Value
toJSON Spigot' {Maybe Double
Maybe Natural
NonEmpty Text
Text
path :: Text
inputs :: NonEmpty Text
name :: Text
topk :: Maybe Natural
prob :: Maybe Double
$sel:path:Spigot' :: Spigot -> Text
$sel:inputs:Spigot' :: Spigot -> NonEmpty Text
$sel:name:Spigot' :: Spigot -> Text
$sel:topk:Spigot' :: Spigot -> Maybe Natural
$sel:prob:Spigot' :: Spigot -> Maybe Double
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Prob" 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 Double
prob,
(Key
"Topk" 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
topk,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Inputs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
inputs),
forall a. a -> Maybe a
Prelude.Just (Key
"Path" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
path)
]
)