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