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