{-# 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.GameLift.Types.AttributeValue 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 AttributeValue = AttributeValue'
{
AttributeValue -> Maybe Double
n :: Prelude.Maybe Prelude.Double,
AttributeValue -> Maybe Text
s :: Prelude.Maybe Prelude.Text,
AttributeValue -> Maybe (HashMap Text Double)
sdm :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double),
AttributeValue -> Maybe [Text]
sl :: Prelude.Maybe [Prelude.Text]
}
deriving (AttributeValue -> AttributeValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeValue -> AttributeValue -> Bool
$c/= :: AttributeValue -> AttributeValue -> Bool
== :: AttributeValue -> AttributeValue -> Bool
$c== :: AttributeValue -> AttributeValue -> Bool
Prelude.Eq, ReadPrec [AttributeValue]
ReadPrec AttributeValue
Int -> ReadS AttributeValue
ReadS [AttributeValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeValue]
$creadListPrec :: ReadPrec [AttributeValue]
readPrec :: ReadPrec AttributeValue
$creadPrec :: ReadPrec AttributeValue
readList :: ReadS [AttributeValue]
$creadList :: ReadS [AttributeValue]
readsPrec :: Int -> ReadS AttributeValue
$creadsPrec :: Int -> ReadS AttributeValue
Prelude.Read, Int -> AttributeValue -> ShowS
[AttributeValue] -> ShowS
AttributeValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeValue] -> ShowS
$cshowList :: [AttributeValue] -> ShowS
show :: AttributeValue -> String
$cshow :: AttributeValue -> String
showsPrec :: Int -> AttributeValue -> ShowS
$cshowsPrec :: Int -> AttributeValue -> ShowS
Prelude.Show, forall x. Rep AttributeValue x -> AttributeValue
forall x. AttributeValue -> Rep AttributeValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeValue x -> AttributeValue
$cfrom :: forall x. AttributeValue -> Rep AttributeValue x
Prelude.Generic)
newAttributeValue ::
AttributeValue
newAttributeValue :: AttributeValue
newAttributeValue =
AttributeValue'
{ $sel:n:AttributeValue' :: Maybe Double
n = forall a. Maybe a
Prelude.Nothing,
$sel:s:AttributeValue' :: Maybe Text
s = forall a. Maybe a
Prelude.Nothing,
$sel:sdm:AttributeValue' :: Maybe (HashMap Text Double)
sdm = forall a. Maybe a
Prelude.Nothing,
$sel:sl:AttributeValue' :: Maybe [Text]
sl = forall a. Maybe a
Prelude.Nothing
}
attributeValue_n :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Double)
attributeValue_n :: Lens' AttributeValue (Maybe Double)
attributeValue_n = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Double
n :: Maybe Double
$sel:n:AttributeValue' :: AttributeValue -> Maybe Double
n} -> Maybe Double
n) (\s :: AttributeValue
s@AttributeValue' {} Maybe Double
a -> AttributeValue
s {$sel:n:AttributeValue' :: Maybe Double
n = Maybe Double
a} :: AttributeValue)
attributeValue_s :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Text)
attributeValue_s :: Lens' AttributeValue (Maybe Text)
attributeValue_s = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Text
s :: Maybe Text
$sel:s:AttributeValue' :: AttributeValue -> Maybe Text
s} -> Maybe Text
s) (\s :: AttributeValue
s@AttributeValue' {} Maybe Text
a -> AttributeValue
s {$sel:s:AttributeValue' :: Maybe Text
s = Maybe Text
a} :: AttributeValue)
attributeValue_sdm :: Lens.Lens' AttributeValue (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double))
attributeValue_sdm :: Lens' AttributeValue (Maybe (HashMap Text Double))
attributeValue_sdm = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe (HashMap Text Double)
sdm :: Maybe (HashMap Text Double)
$sel:sdm:AttributeValue' :: AttributeValue -> Maybe (HashMap Text Double)
sdm} -> Maybe (HashMap Text Double)
sdm) (\s :: AttributeValue
s@AttributeValue' {} Maybe (HashMap Text Double)
a -> AttributeValue
s {$sel:sdm:AttributeValue' :: Maybe (HashMap Text Double)
sdm = Maybe (HashMap Text Double)
a} :: AttributeValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
attributeValue_sl :: Lens.Lens' AttributeValue (Prelude.Maybe [Prelude.Text])
attributeValue_sl :: Lens' AttributeValue (Maybe [Text])
attributeValue_sl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe [Text]
sl :: Maybe [Text]
$sel:sl:AttributeValue' :: AttributeValue -> Maybe [Text]
sl} -> Maybe [Text]
sl) (\s :: AttributeValue
s@AttributeValue' {} Maybe [Text]
a -> AttributeValue
s {$sel:sl:AttributeValue' :: Maybe [Text]
sl = Maybe [Text]
a} :: AttributeValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON AttributeValue where
parseJSON :: Value -> Parser AttributeValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AttributeValue"
( \Object
x ->
Maybe Double
-> Maybe Text
-> Maybe (HashMap Text Double)
-> Maybe [Text]
-> AttributeValue
AttributeValue'
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
"N")
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
"S")
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
"SDM" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"SL" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AttributeValue where
hashWithSalt :: Int -> AttributeValue -> Int
hashWithSalt Int
_salt AttributeValue' {Maybe Double
Maybe [Text]
Maybe Text
Maybe (HashMap Text Double)
sl :: Maybe [Text]
sdm :: Maybe (HashMap Text Double)
s :: Maybe Text
n :: Maybe Double
$sel:sl:AttributeValue' :: AttributeValue -> Maybe [Text]
$sel:sdm:AttributeValue' :: AttributeValue -> Maybe (HashMap Text Double)
$sel:s:AttributeValue' :: AttributeValue -> Maybe Text
$sel:n:AttributeValue' :: AttributeValue -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
n
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Double)
sdm
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
sl
instance Prelude.NFData AttributeValue where
rnf :: AttributeValue -> ()
rnf AttributeValue' {Maybe Double
Maybe [Text]
Maybe Text
Maybe (HashMap Text Double)
sl :: Maybe [Text]
sdm :: Maybe (HashMap Text Double)
s :: Maybe Text
n :: Maybe Double
$sel:sl:AttributeValue' :: AttributeValue -> Maybe [Text]
$sel:sdm:AttributeValue' :: AttributeValue -> Maybe (HashMap Text Double)
$sel:s:AttributeValue' :: AttributeValue -> Maybe Text
$sel:n:AttributeValue' :: AttributeValue -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
n
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Double)
sdm
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
sl
instance Data.ToJSON AttributeValue where
toJSON :: AttributeValue -> Value
toJSON AttributeValue' {Maybe Double
Maybe [Text]
Maybe Text
Maybe (HashMap Text Double)
sl :: Maybe [Text]
sdm :: Maybe (HashMap Text Double)
s :: Maybe Text
n :: Maybe Double
$sel:sl:AttributeValue' :: AttributeValue -> Maybe [Text]
$sel:sdm:AttributeValue' :: AttributeValue -> Maybe (HashMap Text Double)
$sel:s:AttributeValue' :: AttributeValue -> Maybe Text
$sel:n:AttributeValue' :: AttributeValue -> Maybe Double
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"N" 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
n,
(Key
"S" 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 Text
s,
(Key
"SDM" 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 (HashMap Text Double)
sdm,
(Key
"SL" 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 [Text]
sl
]
)