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