{-# 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.Batch.Types.ShareAttributes 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 ShareAttributes = ShareAttributes'
{
ShareAttributes -> Maybe Double
weightFactor :: Prelude.Maybe Prelude.Double,
ShareAttributes -> Text
shareIdentifier :: Prelude.Text
}
deriving (ShareAttributes -> ShareAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShareAttributes -> ShareAttributes -> Bool
$c/= :: ShareAttributes -> ShareAttributes -> Bool
== :: ShareAttributes -> ShareAttributes -> Bool
$c== :: ShareAttributes -> ShareAttributes -> Bool
Prelude.Eq, ReadPrec [ShareAttributes]
ReadPrec ShareAttributes
Int -> ReadS ShareAttributes
ReadS [ShareAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ShareAttributes]
$creadListPrec :: ReadPrec [ShareAttributes]
readPrec :: ReadPrec ShareAttributes
$creadPrec :: ReadPrec ShareAttributes
readList :: ReadS [ShareAttributes]
$creadList :: ReadS [ShareAttributes]
readsPrec :: Int -> ReadS ShareAttributes
$creadsPrec :: Int -> ReadS ShareAttributes
Prelude.Read, Int -> ShareAttributes -> ShowS
[ShareAttributes] -> ShowS
ShareAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShareAttributes] -> ShowS
$cshowList :: [ShareAttributes] -> ShowS
show :: ShareAttributes -> String
$cshow :: ShareAttributes -> String
showsPrec :: Int -> ShareAttributes -> ShowS
$cshowsPrec :: Int -> ShareAttributes -> ShowS
Prelude.Show, forall x. Rep ShareAttributes x -> ShareAttributes
forall x. ShareAttributes -> Rep ShareAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShareAttributes x -> ShareAttributes
$cfrom :: forall x. ShareAttributes -> Rep ShareAttributes x
Prelude.Generic)
newShareAttributes ::
Prelude.Text ->
ShareAttributes
newShareAttributes :: Text -> ShareAttributes
newShareAttributes Text
pShareIdentifier_ =
ShareAttributes'
{ $sel:weightFactor:ShareAttributes' :: Maybe Double
weightFactor = forall a. Maybe a
Prelude.Nothing,
$sel:shareIdentifier:ShareAttributes' :: Text
shareIdentifier = Text
pShareIdentifier_
}
shareAttributes_weightFactor :: Lens.Lens' ShareAttributes (Prelude.Maybe Prelude.Double)
shareAttributes_weightFactor :: Lens' ShareAttributes (Maybe Double)
shareAttributes_weightFactor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareAttributes' {Maybe Double
weightFactor :: Maybe Double
$sel:weightFactor:ShareAttributes' :: ShareAttributes -> Maybe Double
weightFactor} -> Maybe Double
weightFactor) (\s :: ShareAttributes
s@ShareAttributes' {} Maybe Double
a -> ShareAttributes
s {$sel:weightFactor:ShareAttributes' :: Maybe Double
weightFactor = Maybe Double
a} :: ShareAttributes)
shareAttributes_shareIdentifier :: Lens.Lens' ShareAttributes Prelude.Text
shareAttributes_shareIdentifier :: Lens' ShareAttributes Text
shareAttributes_shareIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareAttributes' {Text
shareIdentifier :: Text
$sel:shareIdentifier:ShareAttributes' :: ShareAttributes -> Text
shareIdentifier} -> Text
shareIdentifier) (\s :: ShareAttributes
s@ShareAttributes' {} Text
a -> ShareAttributes
s {$sel:shareIdentifier:ShareAttributes' :: Text
shareIdentifier = Text
a} :: ShareAttributes)
instance Data.FromJSON ShareAttributes where
parseJSON :: Value -> Parser ShareAttributes
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ShareAttributes"
( \Object
x ->
Maybe Double -> Text -> ShareAttributes
ShareAttributes'
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
"weightFactor")
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
"shareIdentifier")
)
instance Prelude.Hashable ShareAttributes where
hashWithSalt :: Int -> ShareAttributes -> Int
hashWithSalt Int
_salt ShareAttributes' {Maybe Double
Text
shareIdentifier :: Text
weightFactor :: Maybe Double
$sel:shareIdentifier:ShareAttributes' :: ShareAttributes -> Text
$sel:weightFactor:ShareAttributes' :: ShareAttributes -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
weightFactor
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
shareIdentifier
instance Prelude.NFData ShareAttributes where
rnf :: ShareAttributes -> ()
rnf ShareAttributes' {Maybe Double
Text
shareIdentifier :: Text
weightFactor :: Maybe Double
$sel:shareIdentifier:ShareAttributes' :: ShareAttributes -> Text
$sel:weightFactor:ShareAttributes' :: ShareAttributes -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
weightFactor
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
shareIdentifier
instance Data.ToJSON ShareAttributes where
toJSON :: ShareAttributes -> Value
toJSON ShareAttributes' {Maybe Double
Text
shareIdentifier :: Text
weightFactor :: Maybe Double
$sel:shareIdentifier:ShareAttributes' :: ShareAttributes -> Text
$sel:weightFactor:ShareAttributes' :: ShareAttributes -> Maybe Double
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"weightFactor" 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
weightFactor,
forall a. a -> Maybe a
Prelude.Just
(Key
"shareIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
shareIdentifier)
]
)