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