{-# 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.ContainerDependency where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types.ContainerCondition
import qualified Amazonka.Prelude as Prelude
data ContainerDependency = ContainerDependency'
{
ContainerDependency -> Text
containerName :: Prelude.Text,
ContainerDependency -> ContainerCondition
condition :: ContainerCondition
}
deriving (ContainerDependency -> ContainerDependency -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerDependency -> ContainerDependency -> Bool
$c/= :: ContainerDependency -> ContainerDependency -> Bool
== :: ContainerDependency -> ContainerDependency -> Bool
$c== :: ContainerDependency -> ContainerDependency -> Bool
Prelude.Eq, ReadPrec [ContainerDependency]
ReadPrec ContainerDependency
Int -> ReadS ContainerDependency
ReadS [ContainerDependency]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerDependency]
$creadListPrec :: ReadPrec [ContainerDependency]
readPrec :: ReadPrec ContainerDependency
$creadPrec :: ReadPrec ContainerDependency
readList :: ReadS [ContainerDependency]
$creadList :: ReadS [ContainerDependency]
readsPrec :: Int -> ReadS ContainerDependency
$creadsPrec :: Int -> ReadS ContainerDependency
Prelude.Read, Int -> ContainerDependency -> ShowS
[ContainerDependency] -> ShowS
ContainerDependency -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerDependency] -> ShowS
$cshowList :: [ContainerDependency] -> ShowS
show :: ContainerDependency -> String
$cshow :: ContainerDependency -> String
showsPrec :: Int -> ContainerDependency -> ShowS
$cshowsPrec :: Int -> ContainerDependency -> ShowS
Prelude.Show, forall x. Rep ContainerDependency x -> ContainerDependency
forall x. ContainerDependency -> Rep ContainerDependency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerDependency x -> ContainerDependency
$cfrom :: forall x. ContainerDependency -> Rep ContainerDependency x
Prelude.Generic)
newContainerDependency ::
Prelude.Text ->
ContainerCondition ->
ContainerDependency
newContainerDependency :: Text -> ContainerCondition -> ContainerDependency
newContainerDependency Text
pContainerName_ ContainerCondition
pCondition_ =
ContainerDependency'
{ $sel:containerName:ContainerDependency' :: Text
containerName =
Text
pContainerName_,
$sel:condition:ContainerDependency' :: ContainerCondition
condition = ContainerCondition
pCondition_
}
containerDependency_containerName :: Lens.Lens' ContainerDependency Prelude.Text
containerDependency_containerName :: Lens' ContainerDependency Text
containerDependency_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDependency' {Text
containerName :: Text
$sel:containerName:ContainerDependency' :: ContainerDependency -> Text
containerName} -> Text
containerName) (\s :: ContainerDependency
s@ContainerDependency' {} Text
a -> ContainerDependency
s {$sel:containerName:ContainerDependency' :: Text
containerName = Text
a} :: ContainerDependency)
containerDependency_condition :: Lens.Lens' ContainerDependency ContainerCondition
containerDependency_condition :: Lens' ContainerDependency ContainerCondition
containerDependency_condition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDependency' {ContainerCondition
condition :: ContainerCondition
$sel:condition:ContainerDependency' :: ContainerDependency -> ContainerCondition
condition} -> ContainerCondition
condition) (\s :: ContainerDependency
s@ContainerDependency' {} ContainerCondition
a -> ContainerDependency
s {$sel:condition:ContainerDependency' :: ContainerCondition
condition = ContainerCondition
a} :: ContainerDependency)
instance Data.FromJSON ContainerDependency where
parseJSON :: Value -> Parser ContainerDependency
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ContainerDependency"
( \Object
x ->
Text -> ContainerCondition -> ContainerDependency
ContainerDependency'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"containerName")
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
"condition")
)
instance Prelude.Hashable ContainerDependency where
hashWithSalt :: Int -> ContainerDependency -> Int
hashWithSalt Int
_salt ContainerDependency' {Text
ContainerCondition
condition :: ContainerCondition
containerName :: Text
$sel:condition:ContainerDependency' :: ContainerDependency -> ContainerCondition
$sel:containerName:ContainerDependency' :: ContainerDependency -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ContainerCondition
condition
instance Prelude.NFData ContainerDependency where
rnf :: ContainerDependency -> ()
rnf ContainerDependency' {Text
ContainerCondition
condition :: ContainerCondition
containerName :: Text
$sel:condition:ContainerDependency' :: ContainerDependency -> ContainerCondition
$sel:containerName:ContainerDependency' :: ContainerDependency -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
containerName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ContainerCondition
condition
instance Data.ToJSON ContainerDependency where
toJSON :: ContainerDependency -> Value
toJSON ContainerDependency' {Text
ContainerCondition
condition :: ContainerCondition
containerName :: Text
$sel:condition:ContainerDependency' :: ContainerDependency -> ContainerCondition
$sel:containerName:ContainerDependency' :: ContainerDependency -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"containerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerName),
forall a. a -> Maybe a
Prelude.Just (Key
"condition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ContainerCondition
condition)
]
)