{-# 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.InstanceDefinition where
import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.GameServerGroupInstanceType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InstanceDefinition = InstanceDefinition'
{
InstanceDefinition -> Maybe Text
weightedCapacity :: Prelude.Maybe Prelude.Text,
InstanceDefinition -> GameServerGroupInstanceType
instanceType :: GameServerGroupInstanceType
}
deriving (InstanceDefinition -> InstanceDefinition -> Bool
(InstanceDefinition -> InstanceDefinition -> Bool)
-> (InstanceDefinition -> InstanceDefinition -> Bool)
-> Eq InstanceDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceDefinition -> InstanceDefinition -> Bool
$c/= :: InstanceDefinition -> InstanceDefinition -> Bool
== :: InstanceDefinition -> InstanceDefinition -> Bool
$c== :: InstanceDefinition -> InstanceDefinition -> Bool
Prelude.Eq, ReadPrec [InstanceDefinition]
ReadPrec InstanceDefinition
Int -> ReadS InstanceDefinition
ReadS [InstanceDefinition]
(Int -> ReadS InstanceDefinition)
-> ReadS [InstanceDefinition]
-> ReadPrec InstanceDefinition
-> ReadPrec [InstanceDefinition]
-> Read InstanceDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceDefinition]
$creadListPrec :: ReadPrec [InstanceDefinition]
readPrec :: ReadPrec InstanceDefinition
$creadPrec :: ReadPrec InstanceDefinition
readList :: ReadS [InstanceDefinition]
$creadList :: ReadS [InstanceDefinition]
readsPrec :: Int -> ReadS InstanceDefinition
$creadsPrec :: Int -> ReadS InstanceDefinition
Prelude.Read, Int -> InstanceDefinition -> ShowS
[InstanceDefinition] -> ShowS
InstanceDefinition -> String
(Int -> InstanceDefinition -> ShowS)
-> (InstanceDefinition -> String)
-> ([InstanceDefinition] -> ShowS)
-> Show InstanceDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceDefinition] -> ShowS
$cshowList :: [InstanceDefinition] -> ShowS
show :: InstanceDefinition -> String
$cshow :: InstanceDefinition -> String
showsPrec :: Int -> InstanceDefinition -> ShowS
$cshowsPrec :: Int -> InstanceDefinition -> ShowS
Prelude.Show, (forall x. InstanceDefinition -> Rep InstanceDefinition x)
-> (forall x. Rep InstanceDefinition x -> InstanceDefinition)
-> Generic InstanceDefinition
forall x. Rep InstanceDefinition x -> InstanceDefinition
forall x. InstanceDefinition -> Rep InstanceDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceDefinition x -> InstanceDefinition
$cfrom :: forall x. InstanceDefinition -> Rep InstanceDefinition x
Prelude.Generic)
newInstanceDefinition ::
GameServerGroupInstanceType ->
InstanceDefinition
newInstanceDefinition :: GameServerGroupInstanceType -> InstanceDefinition
newInstanceDefinition GameServerGroupInstanceType
pInstanceType_ =
InstanceDefinition' :: Maybe Text -> GameServerGroupInstanceType -> InstanceDefinition
InstanceDefinition'
{ $sel:weightedCapacity:InstanceDefinition' :: Maybe Text
weightedCapacity =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceType:InstanceDefinition' :: GameServerGroupInstanceType
instanceType = GameServerGroupInstanceType
pInstanceType_
}
instanceDefinition_weightedCapacity :: Lens.Lens' InstanceDefinition (Prelude.Maybe Prelude.Text)
instanceDefinition_weightedCapacity :: (Maybe Text -> f (Maybe Text))
-> InstanceDefinition -> f InstanceDefinition
instanceDefinition_weightedCapacity = (InstanceDefinition -> Maybe Text)
-> (InstanceDefinition -> Maybe Text -> InstanceDefinition)
-> Lens
InstanceDefinition InstanceDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceDefinition' {Maybe Text
weightedCapacity :: Maybe Text
$sel:weightedCapacity:InstanceDefinition' :: InstanceDefinition -> Maybe Text
weightedCapacity} -> Maybe Text
weightedCapacity) (\s :: InstanceDefinition
s@InstanceDefinition' {} Maybe Text
a -> InstanceDefinition
s {$sel:weightedCapacity:InstanceDefinition' :: Maybe Text
weightedCapacity = Maybe Text
a} :: InstanceDefinition)
instanceDefinition_instanceType :: Lens.Lens' InstanceDefinition GameServerGroupInstanceType
instanceDefinition_instanceType :: (GameServerGroupInstanceType -> f GameServerGroupInstanceType)
-> InstanceDefinition -> f InstanceDefinition
instanceDefinition_instanceType = (InstanceDefinition -> GameServerGroupInstanceType)
-> (InstanceDefinition
-> GameServerGroupInstanceType -> InstanceDefinition)
-> Lens
InstanceDefinition
InstanceDefinition
GameServerGroupInstanceType
GameServerGroupInstanceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceDefinition' {GameServerGroupInstanceType
instanceType :: GameServerGroupInstanceType
$sel:instanceType:InstanceDefinition' :: InstanceDefinition -> GameServerGroupInstanceType
instanceType} -> GameServerGroupInstanceType
instanceType) (\s :: InstanceDefinition
s@InstanceDefinition' {} GameServerGroupInstanceType
a -> InstanceDefinition
s {$sel:instanceType:InstanceDefinition' :: GameServerGroupInstanceType
instanceType = GameServerGroupInstanceType
a} :: InstanceDefinition)
instance Core.FromJSON InstanceDefinition where
parseJSON :: Value -> Parser InstanceDefinition
parseJSON =
String
-> (Object -> Parser InstanceDefinition)
-> Value
-> Parser InstanceDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InstanceDefinition"
( \Object
x ->
Maybe Text -> GameServerGroupInstanceType -> InstanceDefinition
InstanceDefinition'
(Maybe Text -> GameServerGroupInstanceType -> InstanceDefinition)
-> Parser (Maybe Text)
-> Parser (GameServerGroupInstanceType -> InstanceDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WeightedCapacity")
Parser (GameServerGroupInstanceType -> InstanceDefinition)
-> Parser GameServerGroupInstanceType -> Parser InstanceDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser GameServerGroupInstanceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InstanceType")
)
instance Prelude.Hashable InstanceDefinition
instance Prelude.NFData InstanceDefinition
instance Core.ToJSON InstanceDefinition where
toJSON :: InstanceDefinition -> Value
toJSON InstanceDefinition' {Maybe Text
GameServerGroupInstanceType
instanceType :: GameServerGroupInstanceType
weightedCapacity :: Maybe Text
$sel:instanceType:InstanceDefinition' :: InstanceDefinition -> GameServerGroupInstanceType
$sel:weightedCapacity:InstanceDefinition' :: InstanceDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"WeightedCapacity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
weightedCapacity,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceType" Text -> GameServerGroupInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GameServerGroupInstanceType
instanceType)
]
)