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